diff options
Diffstat (limited to 'vendor/github.com')
66 files changed, 0 insertions, 8702 deletions
diff --git a/vendor/github.com/golang/groupcache/LICENSE b/vendor/github.com/golang/groupcache/LICENSE deleted file mode 100644 index 37ec93a..0000000 --- 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 eac1c76..0000000 --- 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 15167cd..0000000 --- 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 1c4577e..0000000 --- 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 0f64693..0000000 --- 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/jsonpb/decode.go b/vendor/github.com/golang/protobuf/jsonpb/decode.go deleted file mode 100644 index 6c16c25..0000000 --- a/vendor/github.com/golang/protobuf/jsonpb/decode.go +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright 2015 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 jsonpb - -import ( -	"encoding/json" -	"errors" -	"fmt" -	"io" -	"math" -	"reflect" -	"strconv" -	"strings" -	"time" - -	"github.com/golang/protobuf/proto" -	"google.golang.org/protobuf/encoding/protojson" -	protoV2 "google.golang.org/protobuf/proto" -	"google.golang.org/protobuf/reflect/protoreflect" -	"google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapJSONUnmarshalV2 = false - -// UnmarshalNext unmarshals the next JSON object from d into m. -func UnmarshalNext(d *json.Decoder, m proto.Message) error { -	return new(Unmarshaler).UnmarshalNext(d, m) -} - -// Unmarshal unmarshals a JSON object from r into m. -func Unmarshal(r io.Reader, m proto.Message) error { -	return new(Unmarshaler).Unmarshal(r, m) -} - -// UnmarshalString unmarshals a JSON object from s into m. -func UnmarshalString(s string, m proto.Message) error { -	return new(Unmarshaler).Unmarshal(strings.NewReader(s), m) -} - -// Unmarshaler is a configurable object for converting from a JSON -// representation to a protocol buffer object. -type Unmarshaler struct { -	// AllowUnknownFields specifies whether to allow messages to contain -	// unknown JSON fields, as opposed to failing to unmarshal. -	AllowUnknownFields bool - -	// AnyResolver is used to resolve the google.protobuf.Any well-known type. -	// If unset, the global registry is used by default. -	AnyResolver AnyResolver -} - -// JSONPBUnmarshaler is implemented by protobuf messages that customize the way -// they are unmarshaled from JSON. Messages that implement this should also -// implement JSONPBMarshaler so that the custom format can be produced. -// -// The JSON unmarshaling must follow the JSON to proto specification: -//	https://developers.google.com/protocol-buffers/docs/proto3#json -// -// Deprecated: Custom types should implement protobuf reflection instead. -type JSONPBUnmarshaler interface { -	UnmarshalJSONPB(*Unmarshaler, []byte) error -} - -// Unmarshal unmarshals a JSON object from r into m. -func (u *Unmarshaler) Unmarshal(r io.Reader, m proto.Message) error { -	return u.UnmarshalNext(json.NewDecoder(r), m) -} - -// UnmarshalNext unmarshals the next JSON object from d into m. -func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error { -	if m == nil { -		return errors.New("invalid nil message") -	} - -	// Parse the next JSON object from the stream. -	raw := json.RawMessage{} -	if err := d.Decode(&raw); err != nil { -		return err -	} - -	// Check for custom unmarshalers first since they may not properly -	// implement protobuf reflection that the logic below relies on. -	if jsu, ok := m.(JSONPBUnmarshaler); ok { -		return jsu.UnmarshalJSONPB(u, raw) -	} - -	mr := proto.MessageReflect(m) - -	// NOTE: For historical reasons, a top-level null is treated as a noop. -	// This is incorrect, but kept for compatibility. -	if string(raw) == "null" && mr.Descriptor().FullName() != "google.protobuf.Value" { -		return nil -	} - -	if wrapJSONUnmarshalV2 { -		// NOTE: If input message is non-empty, we need to preserve merge semantics -		// of the old jsonpb implementation. These semantics are not supported by -		// the protobuf JSON specification. -		isEmpty := true -		mr.Range(func(protoreflect.FieldDescriptor, protoreflect.Value) bool { -			isEmpty = false // at least one iteration implies non-empty -			return false -		}) -		if !isEmpty { -			// Perform unmarshaling into a newly allocated, empty message. -			mr = mr.New() - -			// Use a defer to copy all unmarshaled fields into the original message. -			dst := proto.MessageReflect(m) -			defer mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { -				dst.Set(fd, v) -				return true -			}) -		} - -		// Unmarshal using the v2 JSON unmarshaler. -		opts := protojson.UnmarshalOptions{ -			DiscardUnknown: u.AllowUnknownFields, -		} -		if u.AnyResolver != nil { -			opts.Resolver = anyResolver{u.AnyResolver} -		} -		return opts.Unmarshal(raw, mr.Interface()) -	} else { -		if err := u.unmarshalMessage(mr, raw); err != nil { -			return err -		} -		return protoV2.CheckInitialized(mr.Interface()) -	} -} - -func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error { -	md := m.Descriptor() -	fds := md.Fields() - -	if jsu, ok := proto.MessageV1(m.Interface()).(JSONPBUnmarshaler); ok { -		return jsu.UnmarshalJSONPB(u, in) -	} - -	if string(in) == "null" && md.FullName() != "google.protobuf.Value" { -		return nil -	} - -	switch wellKnownType(md.FullName()) { -	case "Any": -		var jsonObject map[string]json.RawMessage -		if err := json.Unmarshal(in, &jsonObject); err != nil { -			return err -		} - -		rawTypeURL, ok := jsonObject["@type"] -		if !ok { -			return errors.New("Any JSON doesn't have '@type'") -		} -		typeURL, err := unquoteString(string(rawTypeURL)) -		if err != nil { -			return fmt.Errorf("can't unmarshal Any's '@type': %q", rawTypeURL) -		} -		m.Set(fds.ByNumber(1), protoreflect.ValueOfString(typeURL)) - -		var m2 protoreflect.Message -		if u.AnyResolver != nil { -			mi, err := u.AnyResolver.Resolve(typeURL) -			if err != nil { -				return err -			} -			m2 = proto.MessageReflect(mi) -		} else { -			mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) -			if err != nil { -				if err == protoregistry.NotFound { -					return fmt.Errorf("could not resolve Any message type: %v", typeURL) -				} -				return err -			} -			m2 = mt.New() -		} - -		if wellKnownType(m2.Descriptor().FullName()) != "" { -			rawValue, ok := jsonObject["value"] -			if !ok { -				return errors.New("Any JSON doesn't have 'value'") -			} -			if err := u.unmarshalMessage(m2, rawValue); err != nil { -				return fmt.Errorf("can't unmarshal Any nested proto %v: %v", typeURL, err) -			} -		} else { -			delete(jsonObject, "@type") -			rawJSON, err := json.Marshal(jsonObject) -			if err != nil { -				return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", err) -			} -			if err = u.unmarshalMessage(m2, rawJSON); err != nil { -				return fmt.Errorf("can't unmarshal Any nested proto %v: %v", typeURL, err) -			} -		} - -		rawWire, err := protoV2.Marshal(m2.Interface()) -		if err != nil { -			return fmt.Errorf("can't marshal proto %v into Any.Value: %v", typeURL, err) -		} -		m.Set(fds.ByNumber(2), protoreflect.ValueOfBytes(rawWire)) -		return nil -	case "BoolValue", "BytesValue", "StringValue", -		"Int32Value", "UInt32Value", "FloatValue", -		"Int64Value", "UInt64Value", "DoubleValue": -		fd := fds.ByNumber(1) -		v, err := u.unmarshalValue(m.NewField(fd), in, fd) -		if err != nil { -			return err -		} -		m.Set(fd, v) -		return nil -	case "Duration": -		v, err := unquoteString(string(in)) -		if err != nil { -			return err -		} -		d, err := time.ParseDuration(v) -		if err != nil { -			return fmt.Errorf("bad Duration: %v", err) -		} - -		sec := d.Nanoseconds() / 1e9 -		nsec := d.Nanoseconds() % 1e9 -		m.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec))) -		m.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec))) -		return nil -	case "Timestamp": -		v, err := unquoteString(string(in)) -		if err != nil { -			return err -		} -		t, err := time.Parse(time.RFC3339Nano, v) -		if err != nil { -			return fmt.Errorf("bad Timestamp: %v", err) -		} - -		sec := t.Unix() -		nsec := t.Nanosecond() -		m.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec))) -		m.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec))) -		return nil -	case "Value": -		switch { -		case string(in) == "null": -			m.Set(fds.ByNumber(1), protoreflect.ValueOfEnum(0)) -		case string(in) == "true": -			m.Set(fds.ByNumber(4), protoreflect.ValueOfBool(true)) -		case string(in) == "false": -			m.Set(fds.ByNumber(4), protoreflect.ValueOfBool(false)) -		case hasPrefixAndSuffix('"', in, '"'): -			s, err := unquoteString(string(in)) -			if err != nil { -				return fmt.Errorf("unrecognized type for Value %q", in) -			} -			m.Set(fds.ByNumber(3), protoreflect.ValueOfString(s)) -		case hasPrefixAndSuffix('[', in, ']'): -			v := m.Mutable(fds.ByNumber(6)) -			return u.unmarshalMessage(v.Message(), in) -		case hasPrefixAndSuffix('{', in, '}'): -			v := m.Mutable(fds.ByNumber(5)) -			return u.unmarshalMessage(v.Message(), in) -		default: -			f, err := strconv.ParseFloat(string(in), 0) -			if err != nil { -				return fmt.Errorf("unrecognized type for Value %q", in) -			} -			m.Set(fds.ByNumber(2), protoreflect.ValueOfFloat64(f)) -		} -		return nil -	case "ListValue": -		var jsonArray []json.RawMessage -		if err := json.Unmarshal(in, &jsonArray); err != nil { -			return fmt.Errorf("bad ListValue: %v", err) -		} - -		lv := m.Mutable(fds.ByNumber(1)).List() -		for _, raw := range jsonArray { -			ve := lv.NewElement() -			if err := u.unmarshalMessage(ve.Message(), raw); err != nil { -				return err -			} -			lv.Append(ve) -		} -		return nil -	case "Struct": -		var jsonObject map[string]json.RawMessage -		if err := json.Unmarshal(in, &jsonObject); err != nil { -			return fmt.Errorf("bad StructValue: %v", err) -		} - -		mv := m.Mutable(fds.ByNumber(1)).Map() -		for key, raw := range jsonObject { -			kv := protoreflect.ValueOf(key).MapKey() -			vv := mv.NewValue() -			if err := u.unmarshalMessage(vv.Message(), raw); err != nil { -				return fmt.Errorf("bad value in StructValue for key %q: %v", key, err) -			} -			mv.Set(kv, vv) -		} -		return nil -	} - -	var jsonObject map[string]json.RawMessage -	if err := json.Unmarshal(in, &jsonObject); err != nil { -		return err -	} - -	// Handle known fields. -	for i := 0; i < fds.Len(); i++ { -		fd := fds.Get(i) -		if fd.IsWeak() && fd.Message().IsPlaceholder() { -			continue //  weak reference is not linked in -		} - -		// Search for any raw JSON value associated with this field. -		var raw json.RawMessage -		name := string(fd.Name()) -		if fd.Kind() == protoreflect.GroupKind { -			name = string(fd.Message().Name()) -		} -		if v, ok := jsonObject[name]; ok { -			delete(jsonObject, name) -			raw = v -		} -		name = string(fd.JSONName()) -		if v, ok := jsonObject[name]; ok { -			delete(jsonObject, name) -			raw = v -		} - -		field := m.NewField(fd) -		// Unmarshal the field value. -		if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd) && !isSingularJSONPBUnmarshaler(field, fd)) { -			continue -		} -		v, err := u.unmarshalValue(field, raw, fd) -		if err != nil { -			return err -		} -		m.Set(fd, v) -	} - -	// Handle extension fields. -	for name, raw := range jsonObject { -		if !strings.HasPrefix(name, "[") || !strings.HasSuffix(name, "]") { -			continue -		} - -		// Resolve the extension field by name. -		xname := protoreflect.FullName(name[len("[") : len(name)-len("]")]) -		xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) -		if xt == nil && isMessageSet(md) { -			xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) -		} -		if xt == nil { -			continue -		} -		delete(jsonObject, name) -		fd := xt.TypeDescriptor() -		if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { -			return fmt.Errorf("extension field %q does not extend message %q", xname, m.Descriptor().FullName()) -		} - -		field := m.NewField(fd) -		// Unmarshal the field value. -		if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd) && !isSingularJSONPBUnmarshaler(field, fd)) { -			continue -		} -		v, err := u.unmarshalValue(field, raw, fd) -		if err != nil { -			return err -		} -		m.Set(fd, v) -	} - -	if !u.AllowUnknownFields && len(jsonObject) > 0 { -		for name := range jsonObject { -			return fmt.Errorf("unknown field %q in %v", name, md.FullName()) -		} -	} -	return nil -} - -func isSingularWellKnownValue(fd protoreflect.FieldDescriptor) bool { -	if fd.Cardinality() == protoreflect.Repeated { -		return false -	} -	if md := fd.Message(); md != nil { -		return md.FullName() == "google.protobuf.Value" -	} -	if ed := fd.Enum(); ed != nil { -		return ed.FullName() == "google.protobuf.NullValue" -	} -	return false -} - -func isSingularJSONPBUnmarshaler(v protoreflect.Value, fd protoreflect.FieldDescriptor) bool { -	if fd.Message() != nil && fd.Cardinality() != protoreflect.Repeated { -		_, ok := proto.MessageV1(v.Interface()).(JSONPBUnmarshaler) -		return ok -	} -	return false -} - -func (u *Unmarshaler) unmarshalValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { -	switch { -	case fd.IsList(): -		var jsonArray []json.RawMessage -		if err := json.Unmarshal(in, &jsonArray); err != nil { -			return v, err -		} -		lv := v.List() -		for _, raw := range jsonArray { -			ve, err := u.unmarshalSingularValue(lv.NewElement(), raw, fd) -			if err != nil { -				return v, err -			} -			lv.Append(ve) -		} -		return v, nil -	case fd.IsMap(): -		var jsonObject map[string]json.RawMessage -		if err := json.Unmarshal(in, &jsonObject); err != nil { -			return v, err -		} -		kfd := fd.MapKey() -		vfd := fd.MapValue() -		mv := v.Map() -		for key, raw := range jsonObject { -			var kv protoreflect.MapKey -			if kfd.Kind() == protoreflect.StringKind { -				kv = protoreflect.ValueOf(key).MapKey() -			} else { -				v, err := u.unmarshalSingularValue(kfd.Default(), []byte(key), kfd) -				if err != nil { -					return v, err -				} -				kv = v.MapKey() -			} - -			vv, err := u.unmarshalSingularValue(mv.NewValue(), raw, vfd) -			if err != nil { -				return v, err -			} -			mv.Set(kv, vv) -		} -		return v, nil -	default: -		return u.unmarshalSingularValue(v, in, fd) -	} -} - -var nonFinite = map[string]float64{ -	`"NaN"`:       math.NaN(), -	`"Infinity"`:  math.Inf(+1), -	`"-Infinity"`: math.Inf(-1), -} - -func (u *Unmarshaler) unmarshalSingularValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { -	switch fd.Kind() { -	case protoreflect.BoolKind: -		return unmarshalValue(in, new(bool)) -	case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: -		return unmarshalValue(trimQuote(in), new(int32)) -	case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: -		return unmarshalValue(trimQuote(in), new(int64)) -	case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: -		return unmarshalValue(trimQuote(in), new(uint32)) -	case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: -		return unmarshalValue(trimQuote(in), new(uint64)) -	case protoreflect.FloatKind: -		if f, ok := nonFinite[string(in)]; ok { -			return protoreflect.ValueOfFloat32(float32(f)), nil -		} -		return unmarshalValue(trimQuote(in), new(float32)) -	case protoreflect.DoubleKind: -		if f, ok := nonFinite[string(in)]; ok { -			return protoreflect.ValueOfFloat64(float64(f)), nil -		} -		return unmarshalValue(trimQuote(in), new(float64)) -	case protoreflect.StringKind: -		return unmarshalValue(in, new(string)) -	case protoreflect.BytesKind: -		return unmarshalValue(in, new([]byte)) -	case protoreflect.EnumKind: -		if hasPrefixAndSuffix('"', in, '"') { -			vd := fd.Enum().Values().ByName(protoreflect.Name(trimQuote(in))) -			if vd == nil { -				return v, fmt.Errorf("unknown value %q for enum %s", in, fd.Enum().FullName()) -			} -			return protoreflect.ValueOfEnum(vd.Number()), nil -		} -		return unmarshalValue(in, new(protoreflect.EnumNumber)) -	case protoreflect.MessageKind, protoreflect.GroupKind: -		err := u.unmarshalMessage(v.Message(), in) -		return v, err -	default: -		panic(fmt.Sprintf("invalid kind %v", fd.Kind())) -	} -} - -func unmarshalValue(in []byte, v interface{}) (protoreflect.Value, error) { -	err := json.Unmarshal(in, v) -	return protoreflect.ValueOf(reflect.ValueOf(v).Elem().Interface()), err -} - -func unquoteString(in string) (out string, err error) { -	err = json.Unmarshal([]byte(in), &out) -	return out, err -} - -func hasPrefixAndSuffix(prefix byte, in []byte, suffix byte) bool { -	if len(in) >= 2 && in[0] == prefix && in[len(in)-1] == suffix { -		return true -	} -	return false -} - -// trimQuote is like unquoteString but simply strips surrounding quotes. -// This is incorrect, but is behavior done by the legacy implementation. -func trimQuote(in []byte) []byte { -	if len(in) >= 2 && in[0] == '"' && in[len(in)-1] == '"' { -		in = in[1 : len(in)-1] -	} -	return in -} diff --git a/vendor/github.com/golang/protobuf/jsonpb/encode.go b/vendor/github.com/golang/protobuf/jsonpb/encode.go deleted file mode 100644 index 685c80a..0000000 --- a/vendor/github.com/golang/protobuf/jsonpb/encode.go +++ /dev/null @@ -1,559 +0,0 @@ -// Copyright 2015 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 jsonpb - -import ( -	"encoding/json" -	"errors" -	"fmt" -	"io" -	"math" -	"reflect" -	"sort" -	"strconv" -	"strings" -	"time" - -	"github.com/golang/protobuf/proto" -	"google.golang.org/protobuf/encoding/protojson" -	protoV2 "google.golang.org/protobuf/proto" -	"google.golang.org/protobuf/reflect/protoreflect" -	"google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapJSONMarshalV2 = false - -// Marshaler is a configurable object for marshaling protocol buffer messages -// to the specified JSON representation. -type Marshaler struct { -	// OrigName specifies whether to use the original protobuf name for fields. -	OrigName bool - -	// EnumsAsInts specifies whether to render enum values as integers, -	// as opposed to string values. -	EnumsAsInts bool - -	// EmitDefaults specifies whether to render fields with zero values. -	EmitDefaults bool - -	// Indent controls whether the output is compact or not. -	// If empty, the output is compact JSON. Otherwise, every JSON object -	// entry and JSON array value will be on its own line. -	// Each line will be preceded by repeated copies of Indent, where the -	// number of copies is the current indentation depth. -	Indent string - -	// AnyResolver is used to resolve the google.protobuf.Any well-known type. -	// If unset, the global registry is used by default. -	AnyResolver AnyResolver -} - -// JSONPBMarshaler is implemented by protobuf messages that customize the -// way they are marshaled to JSON. Messages that implement this should also -// implement JSONPBUnmarshaler so that the custom format can be parsed. -// -// The JSON marshaling must follow the proto to JSON specification: -//	https://developers.google.com/protocol-buffers/docs/proto3#json -// -// Deprecated: Custom types should implement protobuf reflection instead. -type JSONPBMarshaler interface { -	MarshalJSONPB(*Marshaler) ([]byte, error) -} - -// Marshal serializes a protobuf message as JSON into w. -func (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error { -	b, err := jm.marshal(m) -	if len(b) > 0 { -		if _, err := w.Write(b); err != nil { -			return err -		} -	} -	return err -} - -// MarshalToString serializes a protobuf message as JSON in string form. -func (jm *Marshaler) MarshalToString(m proto.Message) (string, error) { -	b, err := jm.marshal(m) -	if err != nil { -		return "", err -	} -	return string(b), nil -} - -func (jm *Marshaler) marshal(m proto.Message) ([]byte, error) { -	v := reflect.ValueOf(m) -	if m == nil || (v.Kind() == reflect.Ptr && v.IsNil()) { -		return nil, errors.New("Marshal called with nil") -	} - -	// Check for custom marshalers first since they may not properly -	// implement protobuf reflection that the logic below relies on. -	if jsm, ok := m.(JSONPBMarshaler); ok { -		return jsm.MarshalJSONPB(jm) -	} - -	if wrapJSONMarshalV2 { -		opts := protojson.MarshalOptions{ -			UseProtoNames:   jm.OrigName, -			UseEnumNumbers:  jm.EnumsAsInts, -			EmitUnpopulated: jm.EmitDefaults, -			Indent:          jm.Indent, -		} -		if jm.AnyResolver != nil { -			opts.Resolver = anyResolver{jm.AnyResolver} -		} -		return opts.Marshal(proto.MessageReflect(m).Interface()) -	} else { -		// Check for unpopulated required fields first. -		m2 := proto.MessageReflect(m) -		if err := protoV2.CheckInitialized(m2.Interface()); err != nil { -			return nil, err -		} - -		w := jsonWriter{Marshaler: jm} -		err := w.marshalMessage(m2, "", "") -		return w.buf, err -	} -} - -type jsonWriter struct { -	*Marshaler -	buf []byte -} - -func (w *jsonWriter) write(s string) { -	w.buf = append(w.buf, s...) -} - -func (w *jsonWriter) marshalMessage(m protoreflect.Message, indent, typeURL string) error { -	if jsm, ok := proto.MessageV1(m.Interface()).(JSONPBMarshaler); ok { -		b, err := jsm.MarshalJSONPB(w.Marshaler) -		if err != nil { -			return err -		} -		if typeURL != "" { -			// we are marshaling this object to an Any type -			var js map[string]*json.RawMessage -			if err = json.Unmarshal(b, &js); err != nil { -				return fmt.Errorf("type %T produced invalid JSON: %v", m.Interface(), err) -			} -			turl, err := json.Marshal(typeURL) -			if err != nil { -				return fmt.Errorf("failed to marshal type URL %q to JSON: %v", typeURL, err) -			} -			js["@type"] = (*json.RawMessage)(&turl) -			if b, err = json.Marshal(js); err != nil { -				return err -			} -		} -		w.write(string(b)) -		return nil -	} - -	md := m.Descriptor() -	fds := md.Fields() - -	// Handle well-known types. -	const secondInNanos = int64(time.Second / time.Nanosecond) -	switch wellKnownType(md.FullName()) { -	case "Any": -		return w.marshalAny(m, indent) -	case "BoolValue", "BytesValue", "StringValue", -		"Int32Value", "UInt32Value", "FloatValue", -		"Int64Value", "UInt64Value", "DoubleValue": -		fd := fds.ByNumber(1) -		return w.marshalValue(fd, m.Get(fd), indent) -	case "Duration": -		const maxSecondsInDuration = 315576000000 -		// "Generated output always contains 0, 3, 6, or 9 fractional digits, -		//  depending on required precision." -		s := m.Get(fds.ByNumber(1)).Int() -		ns := m.Get(fds.ByNumber(2)).Int() -		if s < -maxSecondsInDuration || s > maxSecondsInDuration { -			return fmt.Errorf("seconds out of range %v", s) -		} -		if ns <= -secondInNanos || ns >= secondInNanos { -			return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) -		} -		if (s > 0 && ns < 0) || (s < 0 && ns > 0) { -			return errors.New("signs of seconds and nanos do not match") -		} -		var sign string -		if s < 0 || ns < 0 { -			sign, s, ns = "-", -1*s, -1*ns -		} -		x := fmt.Sprintf("%s%d.%09d", sign, s, ns) -		x = strings.TrimSuffix(x, "000") -		x = strings.TrimSuffix(x, "000") -		x = strings.TrimSuffix(x, ".000") -		w.write(fmt.Sprintf(`"%vs"`, x)) -		return nil -	case "Timestamp": -		// "RFC 3339, where generated output will always be Z-normalized -		//  and uses 0, 3, 6 or 9 fractional digits." -		s := m.Get(fds.ByNumber(1)).Int() -		ns := m.Get(fds.ByNumber(2)).Int() -		if ns < 0 || ns >= secondInNanos { -			return fmt.Errorf("ns out of range [0, %v)", secondInNanos) -		} -		t := time.Unix(s, ns).UTC() -		// time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). -		x := t.Format("2006-01-02T15:04:05.000000000") -		x = strings.TrimSuffix(x, "000") -		x = strings.TrimSuffix(x, "000") -		x = strings.TrimSuffix(x, ".000") -		w.write(fmt.Sprintf(`"%vZ"`, x)) -		return nil -	case "Value": -		// JSON value; which is a null, number, string, bool, object, or array. -		od := md.Oneofs().Get(0) -		fd := m.WhichOneof(od) -		if fd == nil { -			return errors.New("nil Value") -		} -		return w.marshalValue(fd, m.Get(fd), indent) -	case "Struct", "ListValue": -		// JSON object or array. -		fd := fds.ByNumber(1) -		return w.marshalValue(fd, m.Get(fd), indent) -	} - -	w.write("{") -	if w.Indent != "" { -		w.write("\n") -	} - -	firstField := true -	if typeURL != "" { -		if err := w.marshalTypeURL(indent, typeURL); err != nil { -			return err -		} -		firstField = false -	} - -	for i := 0; i < fds.Len(); { -		fd := fds.Get(i) -		if od := fd.ContainingOneof(); od != nil { -			fd = m.WhichOneof(od) -			i += od.Fields().Len() -			if fd == nil { -				continue -			} -		} else { -			i++ -		} - -		v := m.Get(fd) - -		if !m.Has(fd) { -			if !w.EmitDefaults || fd.ContainingOneof() != nil { -				continue -			} -			if fd.Cardinality() != protoreflect.Repeated && (fd.Message() != nil || fd.Syntax() == protoreflect.Proto2) { -				v = protoreflect.Value{} // use "null" for singular messages or proto2 scalars -			} -		} - -		if !firstField { -			w.writeComma() -		} -		if err := w.marshalField(fd, v, indent); err != nil { -			return err -		} -		firstField = false -	} - -	// Handle proto2 extensions. -	if md.ExtensionRanges().Len() > 0 { -		// Collect a sorted list of all extension descriptor and values. -		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 { -			if !firstField { -				w.writeComma() -			} -			if err := w.marshalField(ext.desc, ext.val, indent); err != nil { -				return err -			} -			firstField = false -		} -	} - -	if w.Indent != "" { -		w.write("\n") -		w.write(indent) -	} -	w.write("}") -	return nil -} - -func (w *jsonWriter) writeComma() { -	if w.Indent != "" { -		w.write(",\n") -	} else { -		w.write(",") -	} -} - -func (w *jsonWriter) marshalAny(m protoreflect.Message, indent string) error { -	// "If the Any contains a value that has a special JSON mapping, -	//  it will be converted as follows: {"@type": xxx, "value": yyy}. -	//  Otherwise, the value will be converted into a JSON object, -	//  and the "@type" field will be inserted to indicate the actual data type." -	md := m.Descriptor() -	typeURL := m.Get(md.Fields().ByNumber(1)).String() -	rawVal := m.Get(md.Fields().ByNumber(2)).Bytes() - -	var m2 protoreflect.Message -	if w.AnyResolver != nil { -		mi, err := w.AnyResolver.Resolve(typeURL) -		if err != nil { -			return err -		} -		m2 = proto.MessageReflect(mi) -	} else { -		mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) -		if err != nil { -			return err -		} -		m2 = mt.New() -	} - -	if err := protoV2.Unmarshal(rawVal, m2.Interface()); err != nil { -		return err -	} - -	if wellKnownType(m2.Descriptor().FullName()) == "" { -		return w.marshalMessage(m2, indent, typeURL) -	} - -	w.write("{") -	if w.Indent != "" { -		w.write("\n") -	} -	if err := w.marshalTypeURL(indent, typeURL); err != nil { -		return err -	} -	w.writeComma() -	if w.Indent != "" { -		w.write(indent) -		w.write(w.Indent) -		w.write(`"value": `) -	} else { -		w.write(`"value":`) -	} -	if err := w.marshalMessage(m2, indent+w.Indent, ""); err != nil { -		return err -	} -	if w.Indent != "" { -		w.write("\n") -		w.write(indent) -	} -	w.write("}") -	return nil -} - -func (w *jsonWriter) marshalTypeURL(indent, typeURL string) error { -	if w.Indent != "" { -		w.write(indent) -		w.write(w.Indent) -	} -	w.write(`"@type":`) -	if w.Indent != "" { -		w.write(" ") -	} -	b, err := json.Marshal(typeURL) -	if err != nil { -		return err -	} -	w.write(string(b)) -	return nil -} - -// marshalField writes field description and value to the Writer. -func (w *jsonWriter) marshalField(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { -	if w.Indent != "" { -		w.write(indent) -		w.write(w.Indent) -	} -	w.write(`"`) -	switch { -	case fd.IsExtension(): -		// For message set, use the fname of the message as the extension name. -		name := string(fd.FullName()) -		if isMessageSet(fd.ContainingMessage()) { -			name = strings.TrimSuffix(name, ".message_set_extension") -		} - -		w.write("[" + name + "]") -	case w.OrigName: -		name := string(fd.Name()) -		if fd.Kind() == protoreflect.GroupKind { -			name = string(fd.Message().Name()) -		} -		w.write(name) -	default: -		w.write(string(fd.JSONName())) -	} -	w.write(`":`) -	if w.Indent != "" { -		w.write(" ") -	} -	return w.marshalValue(fd, v, indent) -} - -func (w *jsonWriter) marshalValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { -	switch { -	case fd.IsList(): -		w.write("[") -		comma := "" -		lv := v.List() -		for i := 0; i < lv.Len(); i++ { -			w.write(comma) -			if w.Indent != "" { -				w.write("\n") -				w.write(indent) -				w.write(w.Indent) -				w.write(w.Indent) -			} -			if err := w.marshalSingularValue(fd, lv.Get(i), indent+w.Indent); err != nil { -				return err -			} -			comma = "," -		} -		if w.Indent != "" { -			w.write("\n") -			w.write(indent) -			w.write(w.Indent) -		} -		w.write("]") -		return nil -	case fd.IsMap(): -		kfd := fd.MapKey() -		vfd := fd.MapValue() -		mv := v.Map() - -		// Collect a sorted list of all map keys and values. -		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") -			} -		}) - -		w.write(`{`) -		comma := "" -		for _, entry := range entries { -			w.write(comma) -			if w.Indent != "" { -				w.write("\n") -				w.write(indent) -				w.write(w.Indent) -				w.write(w.Indent) -			} - -			s := fmt.Sprint(entry.key.Interface()) -			b, err := json.Marshal(s) -			if err != nil { -				return err -			} -			w.write(string(b)) - -			w.write(`:`) -			if w.Indent != "" { -				w.write(` `) -			} - -			if err := w.marshalSingularValue(vfd, entry.val, indent+w.Indent); err != nil { -				return err -			} -			comma = "," -		} -		if w.Indent != "" { -			w.write("\n") -			w.write(indent) -			w.write(w.Indent) -		} -		w.write(`}`) -		return nil -	default: -		return w.marshalSingularValue(fd, v, indent) -	} -} - -func (w *jsonWriter) marshalSingularValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { -	switch { -	case !v.IsValid(): -		w.write("null") -		return nil -	case fd.Message() != nil: -		return w.marshalMessage(v.Message(), indent+w.Indent, "") -	case fd.Enum() != nil: -		if fd.Enum().FullName() == "google.protobuf.NullValue" { -			w.write("null") -			return nil -		} - -		vd := fd.Enum().Values().ByNumber(v.Enum()) -		if vd == nil || w.EnumsAsInts { -			w.write(strconv.Itoa(int(v.Enum()))) -		} else { -			w.write(`"` + string(vd.Name()) + `"`) -		} -		return nil -	default: -		switch v.Interface().(type) { -		case float32, float64: -			switch { -			case math.IsInf(v.Float(), +1): -				w.write(`"Infinity"`) -				return nil -			case math.IsInf(v.Float(), -1): -				w.write(`"-Infinity"`) -				return nil -			case math.IsNaN(v.Float()): -				w.write(`"NaN"`) -				return nil -			} -		case int64, uint64: -			w.write(fmt.Sprintf(`"%d"`, v.Interface())) -			return nil -		} - -		b, err := json.Marshal(v.Interface()) -		if err != nil { -			return err -		} -		w.write(string(b)) -		return nil -	} -} diff --git a/vendor/github.com/golang/protobuf/jsonpb/json.go b/vendor/github.com/golang/protobuf/jsonpb/json.go deleted file mode 100644 index 480e244..0000000 --- a/vendor/github.com/golang/protobuf/jsonpb/json.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2015 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 jsonpb provides functionality to marshal and unmarshal between a -// protocol buffer message and JSON. It follows the specification at -// https://developers.google.com/protocol-buffers/docs/proto3#json. -// -// Do not rely on the default behavior of the standard encoding/json package -// when called on generated message types as it does not operate correctly. -// -// Deprecated: Use the "google.golang.org/protobuf/encoding/protojson" -// package instead. -package jsonpb - -import ( -	"github.com/golang/protobuf/proto" -	"google.golang.org/protobuf/reflect/protoreflect" -	"google.golang.org/protobuf/reflect/protoregistry" -	"google.golang.org/protobuf/runtime/protoimpl" -) - -// AnyResolver takes a type URL, present in an Any message, -// and resolves it into an instance of the associated message. -type AnyResolver interface { -	Resolve(typeURL string) (proto.Message, error) -} - -type anyResolver struct{ AnyResolver } - -func (r anyResolver) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) { -	return r.FindMessageByURL(string(message)) -} - -func (r anyResolver) FindMessageByURL(url string) (protoreflect.MessageType, error) { -	m, err := r.Resolve(url) -	if err != nil { -		return nil, err -	} -	return protoimpl.X.MessageTypeOf(m), nil -} - -func (r anyResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { -	return protoregistry.GlobalTypes.FindExtensionByName(field) -} - -func (r anyResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { -	return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) -} - -func wellKnownType(s protoreflect.FullName) string { -	if s.Parent() == "google.protobuf" { -		switch s.Name() { -		case "Empty", "Any", -			"BoolValue", "BytesValue", "StringValue", -			"Int32Value", "UInt32Value", "FloatValue", -			"Int64Value", "UInt64Value", "DoubleValue", -			"Duration", "Timestamp", -			"NullValue", "Struct", "Value", "ListValue": -			return string(s.Name()) -		} -	} -	return "" -} - -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/buffer.go b/vendor/github.com/golang/protobuf/proto/buffer.go deleted file mode 100644 index e810e6f..0000000 --- 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 d399bf0..0000000 --- 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 e8db57e..0000000 --- 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 2187e87..0000000 --- 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 42fc120..0000000 --- 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 dcdc220..0000000 --- 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 5aee89c..0000000 --- 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 066b432..0000000 --- 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 47eb3e4..0000000 --- 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 a31134e..0000000 --- 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>"), 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 d7c28da..0000000 --- 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 398e348..0000000 --- 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 85f9f57..0000000 --- a/vendor/github.com/golang/protobuf/ptypes/any.go +++ /dev/null @@ -1,179 +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 "<nil>" -	} -	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 0ef27d3..0000000 --- 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 d3c3325..0000000 --- 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 b2b55dd..0000000 --- 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 d0079ee..0000000 --- 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 8368a3f..0000000 --- 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 a76f807..0000000 --- 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/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml deleted file mode 100644 index d8156a6..0000000 --- a/vendor/github.com/google/uuid/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go - -go: -  - 1.4.3 -  - 1.5.3 -  - tip - -script: -  - go test -v ./... diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md deleted file mode 100644 index 04fdf09..0000000 --- a/vendor/github.com/google/uuid/CONTRIBUTING.md +++ /dev/null @@ -1,10 +0,0 @@ -# How to contribute - -We definitely welcome patches and contribution to this project! - -### Legal requirements - -In order to protect both you and ourselves, you will need to sign the -[Contributor License Agreement](https://cla.developers.google.com/clas). - -You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS deleted file mode 100644 index b4bb97f..0000000 --- a/vendor/github.com/google/uuid/CONTRIBUTORS +++ /dev/null @@ -1,9 +0,0 @@ -Paul Borman <borman@google.com> -bmatsuo -shawnps -theory -jboverfelt -dsymonds -cd1 -wallclockbuilder -dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE deleted file mode 100644 index 5dc6826..0000000 --- a/vendor/github.com/google/uuid/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009,2014 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -   * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -   * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. -   * Neither the name of 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/uuid/README.md b/vendor/github.com/google/uuid/README.md deleted file mode 100644 index f765a46..0000000 --- a/vendor/github.com/google/uuid/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# uuid  -The uuid package generates and inspects UUIDs based on -[RFC 4122](http://tools.ietf.org/html/rfc4122) -and DCE 1.1: Authentication and Security Services.  - -This package is based on the github.com/pborman/uuid package (previously named -code.google.com/p/go-uuid).  It differs from these earlier packages in that -a UUID is a 16 byte array rather than a byte slice.  One loss due to this -change is the ability to represent an invalid UUID (vs a NIL UUID). - -###### Install -`go get github.com/google/uuid` - -###### Documentation  -[](http://godoc.org/github.com/google/uuid) - -Full `go doc` style documentation for the package can be viewed online without -installing this package by using the GoDoc site here:  -http://pkg.go.dev/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go deleted file mode 100644 index fa820b9..0000000 --- a/vendor/github.com/google/uuid/dce.go +++ /dev/null @@ -1,80 +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. - -package uuid - -import ( -	"encoding/binary" -	"fmt" -	"os" -) - -// A Domain represents a Version 2 domain -type Domain byte - -// Domain constants for DCE Security (Version 2) UUIDs. -const ( -	Person = Domain(0) -	Group  = Domain(1) -	Org    = Domain(2) -) - -// NewDCESecurity returns a DCE Security (Version 2) UUID. -// -// The domain should be one of Person, Group or Org. -// On a POSIX system the id should be the users UID for the Person -// domain and the users GID for the Group.  The meaning of id for -// the domain Org or on non-POSIX systems is site defined. -// -// For a given domain/id pair the same token may be returned for up to -// 7 minutes and 10 seconds. -func NewDCESecurity(domain Domain, id uint32) (UUID, error) { -	uuid, err := NewUUID() -	if err == nil { -		uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 -		uuid[9] = byte(domain) -		binary.BigEndian.PutUint32(uuid[0:], id) -	} -	return uuid, err -} - -// NewDCEPerson returns a DCE Security (Version 2) UUID in the person -// domain with the id returned by os.Getuid. -// -//  NewDCESecurity(Person, uint32(os.Getuid())) -func NewDCEPerson() (UUID, error) { -	return NewDCESecurity(Person, uint32(os.Getuid())) -} - -// NewDCEGroup returns a DCE Security (Version 2) UUID in the group -// domain with the id returned by os.Getgid. -// -//  NewDCESecurity(Group, uint32(os.Getgid())) -func NewDCEGroup() (UUID, error) { -	return NewDCESecurity(Group, uint32(os.Getgid())) -} - -// Domain returns the domain for a Version 2 UUID.  Domains are only defined -// for Version 2 UUIDs. -func (uuid UUID) Domain() Domain { -	return Domain(uuid[9]) -} - -// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 -// UUIDs. -func (uuid UUID) ID() uint32 { -	return binary.BigEndian.Uint32(uuid[0:4]) -} - -func (d Domain) String() string { -	switch d { -	case Person: -		return "Person" -	case Group: -		return "Group" -	case Org: -		return "Org" -	} -	return fmt.Sprintf("Domain%d", int(d)) -} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go deleted file mode 100644 index 5b8a4b9..0000000 --- a/vendor/github.com/google/uuid/doc.go +++ /dev/null @@ -1,12 +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. - -// Package uuid generates and inspects UUIDs. -// -// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security -// Services. -// -// A UUID is a 16 byte (128 bit) array.  UUIDs may be used as keys to -// maps or compared directly. -package uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go deleted file mode 100644 index b404f4b..0000000 --- a/vendor/github.com/google/uuid/hash.go +++ /dev/null @@ -1,53 +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. - -package uuid - -import ( -	"crypto/md5" -	"crypto/sha1" -	"hash" -) - -// Well known namespace IDs and UUIDs -var ( -	NameSpaceDNS  = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) -	NameSpaceURL  = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) -	NameSpaceOID  = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) -	NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) -	Nil           UUID // empty UUID, all zeros -) - -// NewHash returns a new UUID derived from the hash of space concatenated with -// data generated by h.  The hash should be at least 16 byte in length.  The -// first 16 bytes of the hash are used to form the UUID.  The version of the -// UUID will be the lower 4 bits of version.  NewHash is used to implement -// NewMD5 and NewSHA1. -func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { -	h.Reset() -	h.Write(space[:]) //nolint:errcheck -	h.Write(data)     //nolint:errcheck -	s := h.Sum(nil) -	var uuid UUID -	copy(uuid[:], s) -	uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) -	uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant -	return uuid -} - -// NewMD5 returns a new MD5 (Version 3) UUID based on the -// supplied name space and data.  It is the same as calling: -// -//  NewHash(md5.New(), space, data, 3) -func NewMD5(space UUID, data []byte) UUID { -	return NewHash(md5.New(), space, data, 3) -} - -// NewSHA1 returns a new SHA1 (Version 5) UUID based on the -// supplied name space and data.  It is the same as calling: -// -//  NewHash(sha1.New(), space, data, 5) -func NewSHA1(space UUID, data []byte) UUID { -	return NewHash(sha1.New(), space, data, 5) -} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go deleted file mode 100644 index 14bd340..0000000 --- a/vendor/github.com/google/uuid/marshal.go +++ /dev/null @@ -1,38 +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. - -package uuid - -import "fmt" - -// MarshalText implements encoding.TextMarshaler. -func (uuid UUID) MarshalText() ([]byte, error) { -	var js [36]byte -	encodeHex(js[:], uuid) -	return js[:], nil -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (uuid *UUID) UnmarshalText(data []byte) error { -	id, err := ParseBytes(data) -	if err != nil { -		return err -	} -	*uuid = id -	return nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (uuid UUID) MarshalBinary() ([]byte, error) { -	return uuid[:], nil -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (uuid *UUID) UnmarshalBinary(data []byte) error { -	if len(data) != 16 { -		return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) -	} -	copy(uuid[:], data) -	return nil -} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go deleted file mode 100644 index d651a2b..0000000 --- a/vendor/github.com/google/uuid/node.go +++ /dev/null @@ -1,90 +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. - -package uuid - -import ( -	"sync" -) - -var ( -	nodeMu sync.Mutex -	ifname string  // name of interface being used -	nodeID [6]byte // hardware for version 1 UUIDs -	zeroID [6]byte // nodeID with only 0's -) - -// NodeInterface returns the name of the interface from which the NodeID was -// derived.  The interface "user" is returned if the NodeID was set by -// SetNodeID. -func NodeInterface() string { -	defer nodeMu.Unlock() -	nodeMu.Lock() -	return ifname -} - -// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. -// If name is "" then the first usable interface found will be used or a random -// Node ID will be generated.  If a named interface cannot be found then false -// is returned. -// -// SetNodeInterface never fails when name is "". -func SetNodeInterface(name string) bool { -	defer nodeMu.Unlock() -	nodeMu.Lock() -	return setNodeInterface(name) -} - -func setNodeInterface(name string) bool { -	iname, addr := getHardwareInterface(name) // null implementation for js -	if iname != "" && addr != nil { -		ifname = iname -		copy(nodeID[:], addr) -		return true -	} - -	// We found no interfaces with a valid hardware address.  If name -	// does not specify a specific interface generate a random Node ID -	// (section 4.1.6) -	if name == "" { -		ifname = "random" -		randomBits(nodeID[:]) -		return true -	} -	return false -} - -// NodeID returns a slice of a copy of the current Node ID, setting the Node ID -// if not already set. -func NodeID() []byte { -	defer nodeMu.Unlock() -	nodeMu.Lock() -	if nodeID == zeroID { -		setNodeInterface("") -	} -	nid := nodeID -	return nid[:] -} - -// SetNodeID sets the Node ID to be used for Version 1 UUIDs.  The first 6 bytes -// of id are used.  If id is less than 6 bytes then false is returned and the -// Node ID is not set. -func SetNodeID(id []byte) bool { -	if len(id) < 6 { -		return false -	} -	defer nodeMu.Unlock() -	nodeMu.Lock() -	copy(nodeID[:], id) -	ifname = "user" -	return true -} - -// NodeID returns the 6 byte node id encoded in uuid.  It returns nil if uuid is -// not valid.  The NodeID is only well defined for version 1 and 2 UUIDs. -func (uuid UUID) NodeID() []byte { -	var node [6]byte -	copy(node[:], uuid[10:]) -	return node[:] -} diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go deleted file mode 100644 index 24b78ed..0000000 --- a/vendor/github.com/google/uuid/node_js.go +++ /dev/null @@ -1,12 +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. - -// +build js - -package uuid - -// getHardwareInterface returns nil values for the JS version of the code. -// This remvoves the "net" dependency, because it is not used in the browser. -// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. -func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go deleted file mode 100644 index 0cbbcdd..0000000 --- a/vendor/github.com/google/uuid/node_net.go +++ /dev/null @@ -1,33 +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. - -// +build !js - -package uuid - -import "net" - -var interfaces []net.Interface // cached list of interfaces - -// getHardwareInterface returns the name and hardware address of interface name. -// If name is "" then the name and hardware address of one of the system's -// interfaces is returned.  If no interfaces are found (name does not exist or -// there are no interfaces) then "", nil is returned. -// -// Only addresses of at least 6 bytes are returned. -func getHardwareInterface(name string) (string, []byte) { -	if interfaces == nil { -		var err error -		interfaces, err = net.Interfaces() -		if err != nil { -			return "", nil -		} -	} -	for _, ifs := range interfaces { -		if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { -			return ifs.Name, ifs.HardwareAddr -		} -	} -	return "", nil -} diff --git a/vendor/github.com/google/uuid/null.go b/vendor/github.com/google/uuid/null.go deleted file mode 100644 index d7fcbf2..0000000 --- a/vendor/github.com/google/uuid/null.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2021 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. - -package uuid - -import ( -	"bytes" -	"database/sql/driver" -	"encoding/json" -	"fmt" -) - -var jsonNull = []byte("null") - -// NullUUID represents a UUID that may be null. -// NullUUID implements the SQL driver.Scanner interface so -// it can be used as a scan destination: -// -//  var u uuid.NullUUID -//  err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) -//  ... -//  if u.Valid { -//     // use u.UUID -//  } else { -//     // NULL value -//  } -// -type NullUUID struct { -	UUID  UUID -	Valid bool // Valid is true if UUID is not NULL -} - -// Scan implements the SQL driver.Scanner interface. -func (nu *NullUUID) Scan(value interface{}) error { -	if value == nil { -		nu.UUID, nu.Valid = Nil, false -		return nil -	} - -	err := nu.UUID.Scan(value) -	if err != nil { -		nu.Valid = false -		return err -	} - -	nu.Valid = true -	return nil -} - -// Value implements the driver Valuer interface. -func (nu NullUUID) Value() (driver.Value, error) { -	if !nu.Valid { -		return nil, nil -	} -	// Delegate to UUID Value function -	return nu.UUID.Value() -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (nu NullUUID) MarshalBinary() ([]byte, error) { -	if nu.Valid { -		return nu.UUID[:], nil -	} - -	return []byte(nil), nil -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (nu *NullUUID) UnmarshalBinary(data []byte) error { -	if len(data) != 16 { -		return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) -	} -	copy(nu.UUID[:], data) -	nu.Valid = true -	return nil -} - -// MarshalText implements encoding.TextMarshaler. -func (nu NullUUID) MarshalText() ([]byte, error) { -	if nu.Valid { -		return nu.UUID.MarshalText() -	} - -	return jsonNull, nil -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (nu *NullUUID) UnmarshalText(data []byte) error { -	id, err := ParseBytes(data) -	if err != nil { -		nu.Valid = false -		return err -	} -	nu.UUID = id -	nu.Valid = true -	return nil -} - -// MarshalJSON implements json.Marshaler. -func (nu NullUUID) MarshalJSON() ([]byte, error) { -	if nu.Valid { -		return json.Marshal(nu.UUID) -	} - -	return jsonNull, nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (nu *NullUUID) UnmarshalJSON(data []byte) error { -	if bytes.Equal(data, jsonNull) { -		*nu = NullUUID{} -		return nil // valid null UUID -	} -	err := json.Unmarshal(data, &nu.UUID) -	nu.Valid = err == nil -	return err -} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go deleted file mode 100644 index 2e02ec0..0000000 --- a/vendor/github.com/google/uuid/sql.go +++ /dev/null @@ -1,59 +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. - -package uuid - -import ( -	"database/sql/driver" -	"fmt" -) - -// Scan implements sql.Scanner so UUIDs can be read from databases transparently. -// Currently, database types that map to string and []byte are supported. Please -// consult database-specific driver documentation for matching types. -func (uuid *UUID) Scan(src interface{}) error { -	switch src := src.(type) { -	case nil: -		return nil - -	case string: -		// if an empty UUID comes from a table, we return a null UUID -		if src == "" { -			return nil -		} - -		// see Parse for required string format -		u, err := Parse(src) -		if err != nil { -			return fmt.Errorf("Scan: %v", err) -		} - -		*uuid = u - -	case []byte: -		// if an empty UUID comes from a table, we return a null UUID -		if len(src) == 0 { -			return nil -		} - -		// assumes a simple slice of bytes if 16 bytes -		// otherwise attempts to parse -		if len(src) != 16 { -			return uuid.Scan(string(src)) -		} -		copy((*uuid)[:], src) - -	default: -		return fmt.Errorf("Scan: unable to scan type %T into UUID", src) -	} - -	return nil -} - -// Value implements sql.Valuer so that UUIDs can be written to databases -// transparently. Currently, UUIDs map to strings. Please consult -// database-specific driver documentation for matching types. -func (uuid UUID) Value() (driver.Value, error) { -	return uuid.String(), nil -} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go deleted file mode 100644 index e6ef06c..0000000 --- a/vendor/github.com/google/uuid/time.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. - -package uuid - -import ( -	"encoding/binary" -	"sync" -	"time" -) - -// A Time represents a time as the number of 100's of nanoseconds since 15 Oct -// 1582. -type Time int64 - -const ( -	lillian    = 2299160          // Julian day of 15 Oct 1582 -	unix       = 2440587          // Julian day of 1 Jan 1970 -	epoch      = unix - lillian   // Days between epochs -	g1582      = epoch * 86400    // seconds between epochs -	g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs -) - -var ( -	timeMu   sync.Mutex -	lasttime uint64 // last time we returned -	clockSeq uint16 // clock sequence for this run - -	timeNow = time.Now // for testing -) - -// UnixTime converts t the number of seconds and nanoseconds using the Unix -// epoch of 1 Jan 1970. -func (t Time) UnixTime() (sec, nsec int64) { -	sec = int64(t - g1582ns100) -	nsec = (sec % 10000000) * 100 -	sec /= 10000000 -	return sec, nsec -} - -// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and -// clock sequence as well as adjusting the clock sequence as needed.  An error -// is returned if the current time cannot be determined. -func GetTime() (Time, uint16, error) { -	defer timeMu.Unlock() -	timeMu.Lock() -	return getTime() -} - -func getTime() (Time, uint16, error) { -	t := timeNow() - -	// If we don't have a clock sequence already, set one. -	if clockSeq == 0 { -		setClockSequence(-1) -	} -	now := uint64(t.UnixNano()/100) + g1582ns100 - -	// If time has gone backwards with this clock sequence then we -	// increment the clock sequence -	if now <= lasttime { -		clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 -	} -	lasttime = now -	return Time(now), clockSeq, nil -} - -// ClockSequence returns the current clock sequence, generating one if not -// already set.  The clock sequence is only used for Version 1 UUIDs. -// -// The uuid package does not use global static storage for the clock sequence or -// the last time a UUID was generated.  Unless SetClockSequence is used, a new -// random clock sequence is generated the first time a clock sequence is -// requested by ClockSequence, GetTime, or NewUUID.  (section 4.2.1.1) -func ClockSequence() int { -	defer timeMu.Unlock() -	timeMu.Lock() -	return clockSequence() -} - -func clockSequence() int { -	if clockSeq == 0 { -		setClockSequence(-1) -	} -	return int(clockSeq & 0x3fff) -} - -// SetClockSequence sets the clock sequence to the lower 14 bits of seq.  Setting to -// -1 causes a new sequence to be generated. -func SetClockSequence(seq int) { -	defer timeMu.Unlock() -	timeMu.Lock() -	setClockSequence(seq) -} - -func setClockSequence(seq int) { -	if seq == -1 { -		var b [2]byte -		randomBits(b[:]) // clock sequence -		seq = int(b[0])<<8 | int(b[1]) -	} -	oldSeq := clockSeq -	clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant -	if oldSeq != clockSeq { -		lasttime = 0 -	} -} - -// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in -// uuid.  The time is only defined for version 1 and 2 UUIDs. -func (uuid UUID) Time() Time { -	time := int64(binary.BigEndian.Uint32(uuid[0:4])) -	time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 -	time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 -	return Time(time) -} - -// ClockSequence returns the clock sequence encoded in uuid. -// The clock sequence is only well defined for version 1 and 2 UUIDs. -func (uuid UUID) ClockSequence() int { -	return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff -} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go deleted file mode 100644 index 5ea6c73..0000000 --- a/vendor/github.com/google/uuid/util.go +++ /dev/null @@ -1,43 +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. - -package uuid - -import ( -	"io" -) - -// randomBits completely fills slice b with random data. -func randomBits(b []byte) { -	if _, err := io.ReadFull(rander, b); err != nil { -		panic(err.Error()) // rand should never fail -	} -} - -// xvalues returns the value of a byte as a hexadecimal digit or 255. -var xvalues = [256]byte{ -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, -	255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -} - -// xtob converts hex characters x1 and x2 into a byte. -func xtob(x1, x2 byte) (byte, bool) { -	b1 := xvalues[x1] -	b2 := xvalues[x2] -	return (b1 << 4) | b2, b1 != 255 && b2 != 255 -} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go deleted file mode 100644 index a57207a..0000000 --- a/vendor/github.com/google/uuid/uuid.go +++ /dev/null @@ -1,294 +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. - -package uuid - -import ( -	"bytes" -	"crypto/rand" -	"encoding/hex" -	"errors" -	"fmt" -	"io" -	"strings" -	"sync" -) - -// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC -// 4122. -type UUID [16]byte - -// A Version represents a UUID's version. -type Version byte - -// A Variant represents a UUID's variant. -type Variant byte - -// Constants returned by Variant. -const ( -	Invalid   = Variant(iota) // Invalid UUID -	RFC4122                   // The variant specified in RFC4122 -	Reserved                  // Reserved, NCS backward compatibility. -	Microsoft                 // Reserved, Microsoft Corporation backward compatibility. -	Future                    // Reserved for future definition. -) - -const randPoolSize = 16 * 16 - -var ( -	rander      = rand.Reader // random function -	poolEnabled = false -	poolMu      sync.Mutex -	poolPos     = randPoolSize     // protected with poolMu -	pool        [randPoolSize]byte // protected with poolMu -) - -type invalidLengthError struct{ len int } - -func (err invalidLengthError) Error() string { -	return fmt.Sprintf("invalid UUID length: %d", err.len) -} - -// IsInvalidLengthError is matcher function for custom error invalidLengthError -func IsInvalidLengthError(err error) bool { -	_, ok := err.(invalidLengthError) -	return ok -} - -// Parse decodes s into a UUID or returns an error.  Both the standard UUID -// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the -// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex -// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. -func Parse(s string) (UUID, error) { -	var uuid UUID -	switch len(s) { -	// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -	case 36: - -	// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -	case 36 + 9: -		if strings.ToLower(s[:9]) != "urn:uuid:" { -			return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) -		} -		s = s[9:] - -	// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} -	case 36 + 2: -		s = s[1:] - -	// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -	case 32: -		var ok bool -		for i := range uuid { -			uuid[i], ok = xtob(s[i*2], s[i*2+1]) -			if !ok { -				return uuid, errors.New("invalid UUID format") -			} -		} -		return uuid, nil -	default: -		return uuid, invalidLengthError{len(s)} -	} -	// s is now at least 36 bytes long -	// it must be of the form  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -	if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { -		return uuid, errors.New("invalid UUID format") -	} -	for i, x := range [16]int{ -		0, 2, 4, 6, -		9, 11, -		14, 16, -		19, 21, -		24, 26, 28, 30, 32, 34} { -		v, ok := xtob(s[x], s[x+1]) -		if !ok { -			return uuid, errors.New("invalid UUID format") -		} -		uuid[i] = v -	} -	return uuid, nil -} - -// ParseBytes is like Parse, except it parses a byte slice instead of a string. -func ParseBytes(b []byte) (UUID, error) { -	var uuid UUID -	switch len(b) { -	case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -	case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -		if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { -			return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) -		} -		b = b[9:] -	case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} -		b = b[1:] -	case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -		var ok bool -		for i := 0; i < 32; i += 2 { -			uuid[i/2], ok = xtob(b[i], b[i+1]) -			if !ok { -				return uuid, errors.New("invalid UUID format") -			} -		} -		return uuid, nil -	default: -		return uuid, invalidLengthError{len(b)} -	} -	// s is now at least 36 bytes long -	// it must be of the form  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -	if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { -		return uuid, errors.New("invalid UUID format") -	} -	for i, x := range [16]int{ -		0, 2, 4, 6, -		9, 11, -		14, 16, -		19, 21, -		24, 26, 28, 30, 32, 34} { -		v, ok := xtob(b[x], b[x+1]) -		if !ok { -			return uuid, errors.New("invalid UUID format") -		} -		uuid[i] = v -	} -	return uuid, nil -} - -// MustParse is like Parse but panics if the string cannot be parsed. -// It simplifies safe initialization of global variables holding compiled UUIDs. -func MustParse(s string) UUID { -	uuid, err := Parse(s) -	if err != nil { -		panic(`uuid: Parse(` + s + `): ` + err.Error()) -	} -	return uuid -} - -// FromBytes creates a new UUID from a byte slice. Returns an error if the slice -// does not have a length of 16. The bytes are copied from the slice. -func FromBytes(b []byte) (uuid UUID, err error) { -	err = uuid.UnmarshalBinary(b) -	return uuid, err -} - -// Must returns uuid if err is nil and panics otherwise. -func Must(uuid UUID, err error) UUID { -	if err != nil { -		panic(err) -	} -	return uuid -} - -// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -// , or "" if uuid is invalid. -func (uuid UUID) String() string { -	var buf [36]byte -	encodeHex(buf[:], uuid) -	return string(buf[:]) -} - -// URN returns the RFC 2141 URN form of uuid, -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,  or "" if uuid is invalid. -func (uuid UUID) URN() string { -	var buf [36 + 9]byte -	copy(buf[:], "urn:uuid:") -	encodeHex(buf[9:], uuid) -	return string(buf[:]) -} - -func encodeHex(dst []byte, uuid UUID) { -	hex.Encode(dst, uuid[:4]) -	dst[8] = '-' -	hex.Encode(dst[9:13], uuid[4:6]) -	dst[13] = '-' -	hex.Encode(dst[14:18], uuid[6:8]) -	dst[18] = '-' -	hex.Encode(dst[19:23], uuid[8:10]) -	dst[23] = '-' -	hex.Encode(dst[24:], uuid[10:]) -} - -// Variant returns the variant encoded in uuid. -func (uuid UUID) Variant() Variant { -	switch { -	case (uuid[8] & 0xc0) == 0x80: -		return RFC4122 -	case (uuid[8] & 0xe0) == 0xc0: -		return Microsoft -	case (uuid[8] & 0xe0) == 0xe0: -		return Future -	default: -		return Reserved -	} -} - -// Version returns the version of uuid. -func (uuid UUID) Version() Version { -	return Version(uuid[6] >> 4) -} - -func (v Version) String() string { -	if v > 15 { -		return fmt.Sprintf("BAD_VERSION_%d", v) -	} -	return fmt.Sprintf("VERSION_%d", v) -} - -func (v Variant) String() string { -	switch v { -	case RFC4122: -		return "RFC4122" -	case Reserved: -		return "Reserved" -	case Microsoft: -		return "Microsoft" -	case Future: -		return "Future" -	case Invalid: -		return "Invalid" -	} -	return fmt.Sprintf("BadVariant%d", int(v)) -} - -// SetRand sets the random number generator to r, which implements io.Reader. -// If r.Read returns an error when the package requests random data then -// a panic will be issued. -// -// Calling SetRand with nil sets the random number generator to the default -// generator. -func SetRand(r io.Reader) { -	if r == nil { -		rander = rand.Reader -		return -	} -	rander = r -} - -// EnableRandPool enables internal randomness pool used for Random -// (Version 4) UUID generation. The pool contains random bytes read from -// the random number generator on demand in batches. Enabling the pool -// may improve the UUID generation throughput significantly. -// -// Since the pool is stored on the Go heap, this feature may be a bad fit -// for security sensitive applications. -// -// Both EnableRandPool and DisableRandPool are not thread-safe and should -// only be called when there is no possibility that New or any other -// UUID Version 4 generation function will be called concurrently. -func EnableRandPool() { -	poolEnabled = true -} - -// DisableRandPool disables the randomness pool if it was previously -// enabled with EnableRandPool. -// -// Both EnableRandPool and DisableRandPool are not thread-safe and should -// only be called when there is no possibility that New or any other -// UUID Version 4 generation function will be called concurrently. -func DisableRandPool() { -	poolEnabled = false -	defer poolMu.Unlock() -	poolMu.Lock() -	poolPos = randPoolSize -} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go deleted file mode 100644 index 4631096..0000000 --- a/vendor/github.com/google/uuid/version1.go +++ /dev/null @@ -1,44 +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. - -package uuid - -import ( -	"encoding/binary" -) - -// NewUUID returns a Version 1 UUID based on the current NodeID and clock -// sequence, and the current time.  If the NodeID has not been set by SetNodeID -// or SetNodeInterface then it will be set automatically.  If the NodeID cannot -// be set NewUUID returns nil.  If clock sequence has not been set by -// SetClockSequence then it will be set automatically.  If GetTime fails to -// return the current NewUUID returns nil and an error. -// -// In most cases, New should be used. -func NewUUID() (UUID, error) { -	var uuid UUID -	now, seq, err := GetTime() -	if err != nil { -		return uuid, err -	} - -	timeLow := uint32(now & 0xffffffff) -	timeMid := uint16((now >> 32) & 0xffff) -	timeHi := uint16((now >> 48) & 0x0fff) -	timeHi |= 0x1000 // Version 1 - -	binary.BigEndian.PutUint32(uuid[0:], timeLow) -	binary.BigEndian.PutUint16(uuid[4:], timeMid) -	binary.BigEndian.PutUint16(uuid[6:], timeHi) -	binary.BigEndian.PutUint16(uuid[8:], seq) - -	nodeMu.Lock() -	if nodeID == zeroID { -		setNodeInterface("") -	} -	copy(uuid[10:], nodeID[:]) -	nodeMu.Unlock() - -	return uuid, nil -} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go deleted file mode 100644 index 7697802..0000000 --- a/vendor/github.com/google/uuid/version4.go +++ /dev/null @@ -1,76 +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. - -package uuid - -import "io" - -// New creates a new random UUID or panics.  New is equivalent to -// the expression -// -//    uuid.Must(uuid.NewRandom()) -func New() UUID { -	return Must(NewRandom()) -} - -// NewString creates a new random UUID and returns it as a string or panics. -// NewString is equivalent to the expression -// -//    uuid.New().String() -func NewString() string { -	return Must(NewRandom()).String() -} - -// NewRandom returns a Random (Version 4) UUID. -// -// The strength of the UUIDs is based on the strength of the crypto/rand -// package. -// -// Uses the randomness pool if it was enabled with EnableRandPool. -// -// A note about uniqueness derived from the UUID Wikipedia entry: -// -//  Randomly generated UUIDs have 122 random bits.  One's annual risk of being -//  hit by a meteorite is estimated to be one chance in 17 billion, that -//  means the probability is about 0.00000000006 (6 × 10−11), -//  equivalent to the odds of creating a few tens of trillions of UUIDs in a -//  year and having one duplicate. -func NewRandom() (UUID, error) { -	if !poolEnabled { -		return NewRandomFromReader(rander) -	} -	return newRandomFromPool() -} - -// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader. -func NewRandomFromReader(r io.Reader) (UUID, error) { -	var uuid UUID -	_, err := io.ReadFull(r, uuid[:]) -	if err != nil { -		return Nil, err -	} -	uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 -	uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 -	return uuid, nil -} - -func newRandomFromPool() (UUID, error) { -	var uuid UUID -	poolMu.Lock() -	if poolPos == randPoolSize { -		_, err := io.ReadFull(rander, pool[:]) -		if err != nil { -			poolMu.Unlock() -			return Nil, err -		} -		poolPos = 0 -	} -	copy(uuid[:], pool[poolPos:(poolPos+16)]) -	poolPos += 16 -	poolMu.Unlock() - -	uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 -	uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 -	return uuid, nil -} diff --git a/vendor/github.com/googleapis/enterprise-certificate-proxy/LICENSE b/vendor/github.com/googleapis/enterprise-certificate-proxy/LICENSE deleted file mode 100644 index d645695..0000000 --- a/vendor/github.com/googleapis/enterprise-certificate-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] [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/googleapis/enterprise-certificate-proxy/client/client.go b/vendor/github.com/googleapis/enterprise-certificate-proxy/client/client.go deleted file mode 100644 index b3283b8..0000000 --- a/vendor/github.com/googleapis/enterprise-certificate-proxy/client/client.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2022 Google LLC. -// 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 -// -//     https://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 is a cross-platform client for the signer binary (a.k.a."EnterpriseCertSigner"). -// -// The signer binary is OS-specific, but exposes a standard set of APIs for the client to use. -package client - -import ( -	"crypto" -	"crypto/ecdsa" -	"crypto/rsa" -	"crypto/x509" -	"encoding/gob" -	"errors" -	"fmt" -	"io" -	"net/rpc" -	"os" -	"os/exec" - -	"github.com/googleapis/enterprise-certificate-proxy/client/util" -) - -const signAPI = "EnterpriseCertSigner.Sign" -const certificateChainAPI = "EnterpriseCertSigner.CertificateChain" -const publicKeyAPI = "EnterpriseCertSigner.Public" - -// A Connection wraps a pair of unidirectional streams as an io.ReadWriteCloser. -type Connection struct { -	io.ReadCloser -	io.WriteCloser -} - -// Close closes c's underlying ReadCloser and WriteCloser. -func (c *Connection) Close() error { -	rerr := c.ReadCloser.Close() -	werr := c.WriteCloser.Close() -	if rerr != nil { -		return rerr -	} -	return werr -} - -func init() { -	gob.Register(crypto.SHA256) -	gob.Register(&rsa.PSSOptions{}) -} - -// SignArgs contains arguments to a crypto Signer.Sign method. -type SignArgs struct { -	Digest []byte            // The content to sign. -	Opts   crypto.SignerOpts // Options for signing, such as Hash identifier. -} - -// Key implements credential.Credential by holding the executed signer subprocess. -type Key struct { -	cmd       *exec.Cmd        // Pointer to the signer subprocess. -	client    *rpc.Client      // Pointer to the rpc client that communicates with the signer subprocess. -	publicKey crypto.PublicKey // Public key of loaded certificate. -	chain     [][]byte         // Certificate chain of loaded certificate. -} - -// CertificateChain returns the credential as a raw X509 cert chain. This contains the public key. -func (k *Key) CertificateChain() [][]byte { -	return k.chain -} - -// Close closes the RPC connection and kills the signer subprocess. -// Call this to free up resources when the Key object is no longer needed. -func (k *Key) Close() error { -	if err := k.cmd.Process.Kill(); err != nil { -		return fmt.Errorf("failed to kill signer process: %w", err) -	} -	// Wait for cmd to exit and release resources. Since the process is forcefully killed, this -	// will return a non-nil error (varies by OS), which we will ignore. -	_ = k.cmd.Wait() -	// The Pipes connecting the RPC client should have been closed when the signer subprocess was killed. -	// Calling `k.client.Close()` before `k.cmd.Process.Kill()` or `k.cmd.Wait()` _will_ cause a segfault. -	if err := k.client.Close(); err.Error() != "close |0: file already closed" { -		return fmt.Errorf("failed to close RPC connection: %w", err) -	} -	return nil -} - -// Public returns the public key for this Key. -func (k *Key) Public() crypto.PublicKey { -	return k.publicKey -} - -// Sign signs a message digest, using the specified signer options. -func (k *Key) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signed []byte, err error) { -	if opts != nil && opts.HashFunc() != 0 && len(digest) != opts.HashFunc().Size() { -		return nil, fmt.Errorf("Digest length of %v bytes does not match Hash function size of %v bytes", len(digest), opts.HashFunc().Size()) -	} -	err = k.client.Call(signAPI, SignArgs{Digest: digest, Opts: opts}, &signed) -	return -} - -// ErrCredUnavailable is a sentinel error that indicates ECP Cred is unavailable, -// possibly due to missing config or missing binary path. -var ErrCredUnavailable = errors.New("Cred is unavailable") - -// Cred spawns a signer subprocess that listens on stdin/stdout to perform certificate -// related operations, including signing messages with the private key. -// -// The signer binary path is read from the specified configFilePath, if provided. -// Otherwise, use the default config file path. -// -// The config file also specifies which certificate the signer should use. -func Cred(configFilePath string) (*Key, error) { -	if configFilePath == "" { -		configFilePath = util.GetDefaultConfigFilePath() -	} -	enterpriseCertSignerPath, err := util.LoadSignerBinaryPath(configFilePath) -	if err != nil { -		if errors.Is(err, util.ErrConfigUnavailable) { -			return nil, ErrCredUnavailable -		} -		return nil, err -	} -	k := &Key{ -		cmd: exec.Command(enterpriseCertSignerPath, configFilePath), -	} - -	// Redirect errors from subprocess to parent process. -	k.cmd.Stderr = os.Stderr - -	// RPC client will communicate with subprocess over stdin/stdout. -	kin, err := k.cmd.StdinPipe() -	if err != nil { -		return nil, err -	} -	kout, err := k.cmd.StdoutPipe() -	if err != nil { -		return nil, err -	} -	k.client = rpc.NewClient(&Connection{kout, kin}) - -	if err := k.cmd.Start(); err != nil { -		return nil, fmt.Errorf("starting enterprise cert signer subprocess: %w", err) -	} - -	if err := k.client.Call(certificateChainAPI, struct{}{}, &k.chain); err != nil { -		return nil, fmt.Errorf("failed to retrieve certificate chain: %w", err) -	} - -	var publicKeyBytes []byte -	if err := k.client.Call(publicKeyAPI, struct{}{}, &publicKeyBytes); err != nil { -		return nil, fmt.Errorf("failed to retrieve public key: %w", err) -	} - -	publicKey, err := x509.ParsePKIXPublicKey(publicKeyBytes) -	if err != nil { -		return nil, fmt.Errorf("failed to parse public key: %w", err) -	} - -	var ok bool -	k.publicKey, ok = publicKey.(crypto.PublicKey) -	if !ok { -		return nil, fmt.Errorf("invalid public key type: %T", publicKey) -	} - -	switch pub := k.publicKey.(type) { -	case *rsa.PublicKey: -		if pub.Size() < 256 { -			return nil, fmt.Errorf("RSA modulus size is less than 2048 bits: %v", pub.Size()*8) -		} -	case *ecdsa.PublicKey: -	default: -		return nil, fmt.Errorf("unsupported public key type: %v", pub) -	} - -	return k, nil -} diff --git a/vendor/github.com/googleapis/enterprise-certificate-proxy/client/util/util.go b/vendor/github.com/googleapis/enterprise-certificate-proxy/client/util/util.go deleted file mode 100644 index 1640ec1..0000000 --- a/vendor/github.com/googleapis/enterprise-certificate-proxy/client/util/util.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 Google LLC. -// 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 -// -//     https://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 util provides helper functions for the client. -package util - -import ( -	"encoding/json" -	"errors" -	"io" -	"os" -	"os/user" -	"path/filepath" -	"runtime" -) - -const configFileName = "certificate_config.json" - -// EnterpriseCertificateConfig contains parameters for initializing signer. -type EnterpriseCertificateConfig struct { -	Libs Libs `json:"libs"` -} - -// Libs specifies the locations of helper libraries. -type Libs struct { -	ECP string `json:"ecp"` -} - -// ErrConfigUnavailable is a sentinel error that indicates ECP config is unavailable, -// possibly due to entire config missing or missing binary path. -var ErrConfigUnavailable = errors.New("Config is unavailable") - -// LoadSignerBinaryPath retrieves the path of the signer binary from the config file. -func LoadSignerBinaryPath(configFilePath string) (path string, err error) { -	jsonFile, err := os.Open(configFilePath) -	if err != nil { -		if errors.Is(err, os.ErrNotExist) { -			return "", ErrConfigUnavailable -		} -		return "", err -	} - -	byteValue, err := io.ReadAll(jsonFile) -	if err != nil { -		return "", err -	} -	var config EnterpriseCertificateConfig -	err = json.Unmarshal(byteValue, &config) -	if err != nil { -		return "", err -	} -	signerBinaryPath := config.Libs.ECP -	if signerBinaryPath == "" { -		return "", ErrConfigUnavailable -	} -	return signerBinaryPath, nil -} - -func guessHomeDir() string { -	// Prefer $HOME over user.Current due to glibc bug: golang.org/issue/13470 -	if v := os.Getenv("HOME"); v != "" { -		return v -	} -	// Else, fall back to user.Current: -	if u, err := user.Current(); err == nil { -		return u.HomeDir -	} -	return "" -} - -func getDefaultConfigFileDirectory() (directory string) { -	if runtime.GOOS == "windows" { -		return filepath.Join(os.Getenv("APPDATA"), "gcloud") -	} -	return filepath.Join(guessHomeDir(), ".config/gcloud") -} - -// GetDefaultConfigFilePath returns the default path of the enterprise certificate config file created by gCloud. -func GetDefaultConfigFilePath() (path string) { -	return filepath.Join(getDefaultConfigFileDirectory(), configFileName) -} diff --git a/vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json b/vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json deleted file mode 100644 index 1029563..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ -    "v2": "2.7.1" -} diff --git a/vendor/github.com/googleapis/gax-go/v2/CHANGES.md b/vendor/github.com/googleapis/gax-go/v2/CHANGES.md deleted file mode 100644 index 41a7ca9..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/CHANGES.md +++ /dev/null @@ -1,54 +0,0 @@ -# Changelog - -## [2.7.1](https://github.com/googleapis/gax-go/compare/v2.7.0...v2.7.1) (2023-03-06) - - -### Bug Fixes - -* **v2/apierror:** return Unknown GRPCStatus when err source is HTTP ([#260](https://github.com/googleapis/gax-go/issues/260)) ([043b734](https://github.com/googleapis/gax-go/commit/043b73437a240a91229207fb3ee52a9935a36f23)), refs [#254](https://github.com/googleapis/gax-go/issues/254) - -## [2.7.0](https://github.com/googleapis/gax-go/compare/v2.6.0...v2.7.0) (2022-11-02) - - -### Features - -* update google.golang.org/api to latest ([#240](https://github.com/googleapis/gax-go/issues/240)) ([f690a02](https://github.com/googleapis/gax-go/commit/f690a02c806a2903bdee943ede3a58e3a331ebd6)) -* **v2/apierror:** add apierror.FromWrappingError ([#238](https://github.com/googleapis/gax-go/issues/238)) ([9dbd96d](https://github.com/googleapis/gax-go/commit/9dbd96d59b9d54ceb7c025513aa8c1a9d727382f)) - -## [2.6.0](https://github.com/googleapis/gax-go/compare/v2.5.1...v2.6.0) (2022-10-13) - - -### Features - -* **v2:** copy DetermineContentType functionality ([#230](https://github.com/googleapis/gax-go/issues/230)) ([2c52a70](https://github.com/googleapis/gax-go/commit/2c52a70bae965397f740ed27d46aabe89ff249b3)) - -## [2.5.1](https://github.com/googleapis/gax-go/compare/v2.5.0...v2.5.1) (2022-08-04) - - -### Bug Fixes - -* **v2:** resolve bad genproto pseudoversion in go.mod ([#218](https://github.com/googleapis/gax-go/issues/218)) ([1379b27](https://github.com/googleapis/gax-go/commit/1379b27e9846d959f7e1163b9ef298b3c92c8d23)) - -## [2.5.0](https://github.com/googleapis/gax-go/compare/v2.4.0...v2.5.0) (2022-08-04) - - -### Features - -* add ExtractProtoMessage to apierror ([#213](https://github.com/googleapis/gax-go/issues/213)) ([a6ce70c](https://github.com/googleapis/gax-go/commit/a6ce70c725c890533a9de6272d3b5ba2e336d6bb)) - -## [2.4.0](https://github.com/googleapis/gax-go/compare/v2.3.0...v2.4.0) (2022-05-09) - - -### Features - -* **v2:** add OnHTTPCodes CallOption ([#188](https://github.com/googleapis/gax-go/issues/188)) ([ba7c534](https://github.com/googleapis/gax-go/commit/ba7c5348363ab6c33e1cee3c03c0be68a46ca07c)) - - -### Bug Fixes - -* **v2/apierror:** use errors.As in FromError ([#189](https://github.com/googleapis/gax-go/issues/189)) ([f30f05b](https://github.com/googleapis/gax-go/commit/f30f05be583828f4c09cca4091333ea88ff8d79e)) - - -### Miscellaneous Chores - -* **v2:** bump release-please processing ([#192](https://github.com/googleapis/gax-go/issues/192)) ([56172f9](https://github.com/googleapis/gax-go/commit/56172f971d1141d7687edaac053ad3470af76719)) diff --git a/vendor/github.com/googleapis/gax-go/v2/LICENSE b/vendor/github.com/googleapis/gax-go/v2/LICENSE deleted file mode 100644 index 6d16b65..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2016, Google Inc. -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -   * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -   * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. -   * Neither the name of 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/googleapis/gax-go/v2/apierror/apierror.go b/vendor/github.com/googleapis/gax-go/v2/apierror/apierror.go deleted file mode 100644 index ed862c8..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/apierror/apierror.go +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright 2021, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -//     * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -//     * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -//     * Neither the name of 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 apierror implements a wrapper error for parsing error details from -// API calls. Both HTTP & gRPC status errors are supported. -package apierror - -import ( -	"errors" -	"fmt" -	"strings" - -	jsonerror "github.com/googleapis/gax-go/v2/apierror/internal/proto" -	"google.golang.org/api/googleapi" -	"google.golang.org/genproto/googleapis/rpc/errdetails" -	"google.golang.org/grpc/codes" -	"google.golang.org/grpc/status" -	"google.golang.org/protobuf/encoding/protojson" -	"google.golang.org/protobuf/proto" -) - -// ErrDetails holds the google/rpc/error_details.proto messages. -type ErrDetails struct { -	ErrorInfo           *errdetails.ErrorInfo -	BadRequest          *errdetails.BadRequest -	PreconditionFailure *errdetails.PreconditionFailure -	QuotaFailure        *errdetails.QuotaFailure -	RetryInfo           *errdetails.RetryInfo -	ResourceInfo        *errdetails.ResourceInfo -	RequestInfo         *errdetails.RequestInfo -	DebugInfo           *errdetails.DebugInfo -	Help                *errdetails.Help -	LocalizedMessage    *errdetails.LocalizedMessage - -	// Unknown stores unidentifiable error details. -	Unknown []interface{} -} - -// ErrMessageNotFound is used to signal ExtractProtoMessage found no matching messages. -var ErrMessageNotFound = errors.New("message not found") - -// ExtractProtoMessage provides a mechanism for extracting protobuf messages from the -// Unknown error details. If ExtractProtoMessage finds an unknown message of the same type, -// the content of the message is copied to the provided message. -// -// ExtractProtoMessage will return ErrMessageNotFound if there are no message matching the -// protocol buffer type of the provided message. -func (e ErrDetails) ExtractProtoMessage(v proto.Message) error { -	if v == nil { -		return ErrMessageNotFound -	} -	for _, elem := range e.Unknown { -		if elemProto, ok := elem.(proto.Message); ok { -			if v.ProtoReflect().Type() == elemProto.ProtoReflect().Type() { -				proto.Merge(v, elemProto) -				return nil -			} -		} -	} -	return ErrMessageNotFound -} - -func (e ErrDetails) String() string { -	var d strings.Builder -	if e.ErrorInfo != nil { -		d.WriteString(fmt.Sprintf("error details: name = ErrorInfo reason = %s domain = %s metadata = %s\n", -			e.ErrorInfo.GetReason(), e.ErrorInfo.GetDomain(), e.ErrorInfo.GetMetadata())) -	} - -	if e.BadRequest != nil { -		v := e.BadRequest.GetFieldViolations() -		var f []string -		var desc []string -		for _, x := range v { -			f = append(f, x.GetField()) -			desc = append(desc, x.GetDescription()) -		} -		d.WriteString(fmt.Sprintf("error details: name = BadRequest field = %s desc = %s\n", -			strings.Join(f, " "), strings.Join(desc, " "))) -	} - -	if e.PreconditionFailure != nil { -		v := e.PreconditionFailure.GetViolations() -		var t []string -		var s []string -		var desc []string -		for _, x := range v { -			t = append(t, x.GetType()) -			s = append(s, x.GetSubject()) -			desc = append(desc, x.GetDescription()) -		} -		d.WriteString(fmt.Sprintf("error details: name = PreconditionFailure type = %s subj = %s desc = %s\n", strings.Join(t, " "), -			strings.Join(s, " "), strings.Join(desc, " "))) -	} - -	if e.QuotaFailure != nil { -		v := e.QuotaFailure.GetViolations() -		var s []string -		var desc []string -		for _, x := range v { -			s = append(s, x.GetSubject()) -			desc = append(desc, x.GetDescription()) -		} -		d.WriteString(fmt.Sprintf("error details: name = QuotaFailure subj = %s desc = %s\n", -			strings.Join(s, " "), strings.Join(desc, " "))) -	} - -	if e.RequestInfo != nil { -		d.WriteString(fmt.Sprintf("error details: name = RequestInfo id = %s data = %s\n", -			e.RequestInfo.GetRequestId(), e.RequestInfo.GetServingData())) -	} - -	if e.ResourceInfo != nil { -		d.WriteString(fmt.Sprintf("error details: name = ResourceInfo type = %s resourcename = %s owner = %s desc = %s\n", -			e.ResourceInfo.GetResourceType(), e.ResourceInfo.GetResourceName(), -			e.ResourceInfo.GetOwner(), e.ResourceInfo.GetDescription())) - -	} -	if e.RetryInfo != nil { -		d.WriteString(fmt.Sprintf("error details: retry in %s\n", e.RetryInfo.GetRetryDelay().AsDuration())) - -	} -	if e.Unknown != nil { -		var s []string -		for _, x := range e.Unknown { -			s = append(s, fmt.Sprintf("%v", x)) -		} -		d.WriteString(fmt.Sprintf("error details: name = Unknown  desc = %s\n", strings.Join(s, " "))) -	} - -	if e.DebugInfo != nil { -		d.WriteString(fmt.Sprintf("error details: name = DebugInfo detail = %s stack = %s\n", e.DebugInfo.GetDetail(), -			strings.Join(e.DebugInfo.GetStackEntries(), " "))) -	} -	if e.Help != nil { -		var desc []string -		var url []string -		for _, x := range e.Help.Links { -			desc = append(desc, x.GetDescription()) -			url = append(url, x.GetUrl()) -		} -		d.WriteString(fmt.Sprintf("error details: name = Help desc = %s url = %s\n", -			strings.Join(desc, " "), strings.Join(url, " "))) -	} -	if e.LocalizedMessage != nil { -		d.WriteString(fmt.Sprintf("error details: name = LocalizedMessage locale = %s msg = %s\n", -			e.LocalizedMessage.GetLocale(), e.LocalizedMessage.GetMessage())) -	} - -	return d.String() -} - -// APIError wraps either a gRPC Status error or a HTTP googleapi.Error. It -// implements error and Status interfaces. -type APIError struct { -	err     error -	status  *status.Status -	httpErr *googleapi.Error -	details ErrDetails -} - -// Details presents the error details of the APIError. -func (a *APIError) Details() ErrDetails { -	return a.details -} - -// Unwrap extracts the original error. -func (a *APIError) Unwrap() error { -	return a.err -} - -// Error returns a readable representation of the APIError. -func (a *APIError) Error() string { -	var msg string -	if a.httpErr != nil { -		// Truncate the googleapi.Error message because it dumps the Details in -		// an ugly way. -		msg = fmt.Sprintf("googleapi: Error %d: %s", a.httpErr.Code, a.httpErr.Message) -	} else if a.status != nil { -		msg = a.err.Error() -	} -	return strings.TrimSpace(fmt.Sprintf("%s\n%s", msg, a.details)) -} - -// GRPCStatus extracts the underlying gRPC Status error. -// This method is necessary to fulfill the interface -// described in https://pkg.go.dev/google.golang.org/grpc/status#FromError. -func (a *APIError) GRPCStatus() *status.Status { -	return a.status -} - -// Reason returns the reason in an ErrorInfo. -// If ErrorInfo is nil, it returns an empty string. -func (a *APIError) Reason() string { -	return a.details.ErrorInfo.GetReason() -} - -// Domain returns the domain in an ErrorInfo. -// If ErrorInfo is nil, it returns an empty string. -func (a *APIError) Domain() string { -	return a.details.ErrorInfo.GetDomain() -} - -// Metadata returns the metadata in an ErrorInfo. -// If ErrorInfo is nil, it returns nil. -func (a *APIError) Metadata() map[string]string { -	return a.details.ErrorInfo.GetMetadata() - -} - -// setDetailsFromError parses a Status error or a googleapi.Error -// and sets status and details or httpErr and details, respectively. -// It returns false if neither Status nor googleapi.Error can be parsed. -// When err is a googleapi.Error, the status of the returned error will -// be set to an Unknown error, rather than nil, since a nil code is -// interpreted as OK in the gRPC status package. -func (a *APIError) setDetailsFromError(err error) bool { -	st, isStatus := status.FromError(err) -	var herr *googleapi.Error -	isHTTPErr := errors.As(err, &herr) - -	switch { -	case isStatus: -		a.status = st -		a.details = parseDetails(st.Details()) -	case isHTTPErr: -		a.httpErr = herr -		a.details = parseHTTPDetails(herr) -		a.status = status.New(codes.Unknown, herr.Message) -	default: -		return false -	} -	return true -} - -// FromError parses a Status error or a googleapi.Error and builds an -// APIError, wrapping the provided error in the new APIError. It -// returns false if neither Status nor googleapi.Error can be parsed. -func FromError(err error) (*APIError, bool) { -	return ParseError(err, true) -} - -// ParseError parses a Status error or a googleapi.Error and builds an -// APIError. If wrap is true, it wraps the error in the new APIError. -// It returns false if neither Status nor googleapi.Error can be parsed. -func ParseError(err error, wrap bool) (*APIError, bool) { -	if err == nil { -		return nil, false -	} -	ae := APIError{} -	if wrap { -		ae = APIError{err: err} -	} -	if !ae.setDetailsFromError(err) { -		return nil, false -	} -	return &ae, true -} - -// parseDetails accepts a slice of interface{} that should be backed by some -// sort of proto.Message that can be cast to the google/rpc/error_details.proto -// types. -// -// This is for internal use only. -func parseDetails(details []interface{}) ErrDetails { -	var ed ErrDetails -	for _, d := range details { -		switch d := d.(type) { -		case *errdetails.ErrorInfo: -			ed.ErrorInfo = d -		case *errdetails.BadRequest: -			ed.BadRequest = d -		case *errdetails.PreconditionFailure: -			ed.PreconditionFailure = d -		case *errdetails.QuotaFailure: -			ed.QuotaFailure = d -		case *errdetails.RetryInfo: -			ed.RetryInfo = d -		case *errdetails.ResourceInfo: -			ed.ResourceInfo = d -		case *errdetails.RequestInfo: -			ed.RequestInfo = d -		case *errdetails.DebugInfo: -			ed.DebugInfo = d -		case *errdetails.Help: -			ed.Help = d -		case *errdetails.LocalizedMessage: -			ed.LocalizedMessage = d -		default: -			ed.Unknown = append(ed.Unknown, d) -		} -	} - -	return ed -} - -// parseHTTPDetails will convert the given googleapi.Error into the protobuf -// representation then parse the Any values that contain the error details. -// -// This is for internal use only. -func parseHTTPDetails(gae *googleapi.Error) ErrDetails { -	e := &jsonerror.Error{} -	if err := protojson.Unmarshal([]byte(gae.Body), e); err != nil { -		// If the error body does not conform to the error schema, ignore it -		// altogther. See https://cloud.google.com/apis/design/errors#http_mapping. -		return ErrDetails{} -	} - -	// Coerce the Any messages into proto.Message then parse the details. -	details := []interface{}{} -	for _, any := range e.GetError().GetDetails() { -		m, err := any.UnmarshalNew() -		if err != nil { -			// Ignore malformed Any values. -			continue -		} -		details = append(details, m) -	} - -	return parseDetails(details) -} diff --git a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/README.md b/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/README.md deleted file mode 100644 index 9ff0cae..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# HTTP JSON Error Schema - -The `error.proto` represents the HTTP-JSON schema used by Google APIs to convey -error payloads as described by https://cloud.google.com/apis/design/errors#http_mapping. -This package is for internal parsing logic only and should not be used in any -other context. - -## Regeneration - -To regenerate the protobuf Go code you will need the following: - -* A local copy of [googleapis], the absolute path to which should be exported to -the environment variable `GOOGLEAPIS` -* The protobuf compiler [protoc] -* The Go [protobuf plugin] -* The [goimports] tool - -From this directory run the following command: -```sh -protoc -I $GOOGLEAPIS -I. --go_out=. --go_opt=module=github.com/googleapis/gax-go/v2/apierror/internal/proto error.proto -goimports -w . -``` - -Note: the `module` plugin option ensures the generated code is placed in this -directory, and not in several nested directories defined by `go_package` option. - -[googleapis]: https://github.com/googleapis/googleapis -[protoc]: https://github.com/protocolbuffers/protobuf#protocol-compiler-installation -[protobuf plugin]: https://developers.google.com/protocol-buffers/docs/reference/go-generated -[goimports]: https://pkg.go.dev/golang.org/x/tools/cmd/goimports
\ No newline at end of file diff --git a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/custom_error.pb.go b/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/custom_error.pb.go deleted file mode 100644 index e4b03f1..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/custom_error.pb.go +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright 2022 Google LLC -// -// 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.28.0 -// 	protoc        v3.17.3 -// source: custom_error.proto - -package jsonerror - -import ( -	reflect "reflect" -	sync "sync" - -	protoreflect "google.golang.org/protobuf/reflect/protoreflect" -	protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -// Error code for `CustomError`. -type CustomError_CustomErrorCode int32 - -const ( -	// Default error. -	CustomError_CUSTOM_ERROR_CODE_UNSPECIFIED CustomError_CustomErrorCode = 0 -	// Too many foo. -	CustomError_TOO_MANY_FOO CustomError_CustomErrorCode = 1 -	// Not enough foo. -	CustomError_NOT_ENOUGH_FOO CustomError_CustomErrorCode = 2 -	// Catastrophic error. -	CustomError_UNIVERSE_WAS_DESTROYED CustomError_CustomErrorCode = 3 -) - -// Enum value maps for CustomError_CustomErrorCode. -var ( -	CustomError_CustomErrorCode_name = map[int32]string{ -		0: "CUSTOM_ERROR_CODE_UNSPECIFIED", -		1: "TOO_MANY_FOO", -		2: "NOT_ENOUGH_FOO", -		3: "UNIVERSE_WAS_DESTROYED", -	} -	CustomError_CustomErrorCode_value = map[string]int32{ -		"CUSTOM_ERROR_CODE_UNSPECIFIED": 0, -		"TOO_MANY_FOO":                  1, -		"NOT_ENOUGH_FOO":                2, -		"UNIVERSE_WAS_DESTROYED":        3, -	} -) - -func (x CustomError_CustomErrorCode) Enum() *CustomError_CustomErrorCode { -	p := new(CustomError_CustomErrorCode) -	*p = x -	return p -} - -func (x CustomError_CustomErrorCode) String() string { -	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CustomError_CustomErrorCode) Descriptor() protoreflect.EnumDescriptor { -	return file_custom_error_proto_enumTypes[0].Descriptor() -} - -func (CustomError_CustomErrorCode) Type() protoreflect.EnumType { -	return &file_custom_error_proto_enumTypes[0] -} - -func (x CustomError_CustomErrorCode) Number() protoreflect.EnumNumber { -	return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CustomError_CustomErrorCode.Descriptor instead. -func (CustomError_CustomErrorCode) EnumDescriptor() ([]byte, []int) { -	return file_custom_error_proto_rawDescGZIP(), []int{0, 0} -} - -// CustomError is an example of a custom error message  which may be included -// in an rpc status. It is not meant to reflect a standard error. -type CustomError struct { -	state         protoimpl.MessageState -	sizeCache     protoimpl.SizeCache -	unknownFields protoimpl.UnknownFields - -	// Error code specific to the custom API being invoked. -	Code CustomError_CustomErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=error.CustomError_CustomErrorCode" json:"code,omitempty"` -	// Name of the failed entity. -	Entity string `protobuf:"bytes,2,opt,name=entity,proto3" json:"entity,omitempty"` -	// Message that describes the error. -	ErrorMessage string `protobuf:"bytes,3,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` -} - -func (x *CustomError) Reset() { -	*x = CustomError{} -	if protoimpl.UnsafeEnabled { -		mi := &file_custom_error_proto_msgTypes[0] -		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) -		ms.StoreMessageInfo(mi) -	} -} - -func (x *CustomError) String() string { -	return protoimpl.X.MessageStringOf(x) -} - -func (*CustomError) ProtoMessage() {} - -func (x *CustomError) ProtoReflect() protoreflect.Message { -	mi := &file_custom_error_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 CustomError.ProtoReflect.Descriptor instead. -func (*CustomError) Descriptor() ([]byte, []int) { -	return file_custom_error_proto_rawDescGZIP(), []int{0} -} - -func (x *CustomError) GetCode() CustomError_CustomErrorCode { -	if x != nil { -		return x.Code -	} -	return CustomError_CUSTOM_ERROR_CODE_UNSPECIFIED -} - -func (x *CustomError) GetEntity() string { -	if x != nil { -		return x.Entity -	} -	return "" -} - -func (x *CustomError) GetErrorMessage() string { -	if x != nil { -		return x.ErrorMessage -	} -	return "" -} - -var File_custom_error_proto protoreflect.FileDescriptor - -var file_custom_error_proto_rawDesc = []byte{ -	0x0a, 0x12, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x70, -	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xfa, 0x01, 0x0a, 0x0b, -	0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x36, 0x0a, 0x04, 0x63, -	0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x65, 0x72, 0x72, 0x6f, -	0x72, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x43, 0x75, -	0x73, 0x74, 0x6f, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, -	0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, -	0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x65, -	0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, -	0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, -	0x22, 0x76, 0x0a, 0x0f, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, -	0x6f, 0x64, 0x65, 0x12, 0x21, 0x0a, 0x1d, 0x43, 0x55, 0x53, 0x54, 0x4f, 0x4d, 0x5f, 0x45, 0x52, -	0x52, 0x4f, 0x52, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, -	0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x4f, 0x4f, 0x5f, 0x4d, 0x41, -	0x4e, 0x59, 0x5f, 0x46, 0x4f, 0x4f, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x4f, 0x54, 0x5f, -	0x45, 0x4e, 0x4f, 0x55, 0x47, 0x48, 0x5f, 0x46, 0x4f, 0x4f, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, -	0x55, 0x4e, 0x49, 0x56, 0x45, 0x52, 0x53, 0x45, 0x5f, 0x57, 0x41, 0x53, 0x5f, 0x44, 0x45, 0x53, -	0x54, 0x52, 0x4f, 0x59, 0x45, 0x44, 0x10, 0x03, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, -	0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, -	0x73, 0x2f, 0x67, 0x61, 0x78, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x69, 0x65, -	0x72, 0x72, 0x6f, 0x72, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, -	0x6f, 0x74, 0x6f, 0x3b, 0x6a, 0x73, 0x6f, 0x6e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x62, 0x06, 0x70, -	0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( -	file_custom_error_proto_rawDescOnce sync.Once -	file_custom_error_proto_rawDescData = file_custom_error_proto_rawDesc -) - -func file_custom_error_proto_rawDescGZIP() []byte { -	file_custom_error_proto_rawDescOnce.Do(func() { -		file_custom_error_proto_rawDescData = protoimpl.X.CompressGZIP(file_custom_error_proto_rawDescData) -	}) -	return file_custom_error_proto_rawDescData -} - -var file_custom_error_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_custom_error_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_custom_error_proto_goTypes = []interface{}{ -	(CustomError_CustomErrorCode)(0), // 0: error.CustomError.CustomErrorCode -	(*CustomError)(nil),              // 1: error.CustomError -} -var file_custom_error_proto_depIdxs = []int32{ -	0, // 0: error.CustomError.code:type_name -> error.CustomError.CustomErrorCode -	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_custom_error_proto_init() } -func file_custom_error_proto_init() { -	if File_custom_error_proto != nil { -		return -	} -	if !protoimpl.UnsafeEnabled { -		file_custom_error_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { -			switch v := v.(*CustomError); 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_custom_error_proto_rawDesc, -			NumEnums:      1, -			NumMessages:   1, -			NumExtensions: 0, -			NumServices:   0, -		}, -		GoTypes:           file_custom_error_proto_goTypes, -		DependencyIndexes: file_custom_error_proto_depIdxs, -		EnumInfos:         file_custom_error_proto_enumTypes, -		MessageInfos:      file_custom_error_proto_msgTypes, -	}.Build() -	File_custom_error_proto = out.File -	file_custom_error_proto_rawDesc = nil -	file_custom_error_proto_goTypes = nil -	file_custom_error_proto_depIdxs = nil -} diff --git a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/custom_error.proto b/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/custom_error.proto deleted file mode 100644 index 21678ae..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/custom_error.proto +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2022 Google LLC -// -// 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 error; - -option go_package = "github.com/googleapis/gax-go/v2/apierror/internal/proto;jsonerror"; - - -// CustomError is an example of a custom error message  which may be included -// in an rpc status. It is not meant to reflect a standard error. -message CustomError { - -  // Error code for `CustomError`. -  enum CustomErrorCode { -    // Default error. -    CUSTOM_ERROR_CODE_UNSPECIFIED = 0; - -    // Too many foo. -    TOO_MANY_FOO = 1; - -    // Not enough foo. -    NOT_ENOUGH_FOO = 2; - -    // Catastrophic error. -    UNIVERSE_WAS_DESTROYED = 3; - -  } - -  // Error code specific to the custom API being invoked. -  CustomErrorCode code = 1; - -  // Name of the failed entity. -  string entity = 2; - -  // Message that describes the error. -  string error_message = 3; -} diff --git a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/error.pb.go b/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/error.pb.go deleted file mode 100644 index 7dd9b83..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/error.pb.go +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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.28.0 -// 	protoc        v3.15.8 -// source: apierror/internal/proto/error.proto - -package jsonerror - -import ( -	reflect "reflect" -	sync "sync" - -	code "google.golang.org/genproto/googleapis/rpc/code" -	protoreflect "google.golang.org/protobuf/reflect/protoreflect" -	protoimpl "google.golang.org/protobuf/runtime/protoimpl" -	anypb "google.golang.org/protobuf/types/known/anypb" -) - -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 error format v2 for Google JSON REST APIs. -// Copied from https://cloud.google.com/apis/design/errors#http_mapping. -// -// NOTE: This schema is not used for other wire protocols. -type Error struct { -	state         protoimpl.MessageState -	sizeCache     protoimpl.SizeCache -	unknownFields protoimpl.UnknownFields - -	// The actual error payload. The nested message structure is for backward -	// compatibility with Google API client libraries. It also makes the error -	// more readable to developers. -	Error *Error_Status `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *Error) Reset() { -	*x = Error{} -	if protoimpl.UnsafeEnabled { -		mi := &file_apierror_internal_proto_error_proto_msgTypes[0] -		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) -		ms.StoreMessageInfo(mi) -	} -} - -func (x *Error) String() string { -	return protoimpl.X.MessageStringOf(x) -} - -func (*Error) ProtoMessage() {} - -func (x *Error) ProtoReflect() protoreflect.Message { -	mi := &file_apierror_internal_proto_error_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 Error.ProtoReflect.Descriptor instead. -func (*Error) Descriptor() ([]byte, []int) { -	return file_apierror_internal_proto_error_proto_rawDescGZIP(), []int{0} -} - -func (x *Error) GetError() *Error_Status { -	if x != nil { -		return x.Error -	} -	return nil -} - -// This message has the same semantics as `google.rpc.Status`. It uses HTTP -// status code instead of gRPC status code. It has an extra field `status` -// for backward compatibility with Google API Client Libraries. -type Error_Status struct { -	state         protoimpl.MessageState -	sizeCache     protoimpl.SizeCache -	unknownFields protoimpl.UnknownFields - -	// The HTTP status code that corresponds to `google.rpc.Status.code`. -	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` -	// This corresponds to `google.rpc.Status.message`. -	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` -	// This is the enum version for `google.rpc.Status.code`. -	Status code.Code `protobuf:"varint,4,opt,name=status,proto3,enum=google.rpc.Code" json:"status,omitempty"` -	// This corresponds to `google.rpc.Status.details`. -	Details []*anypb.Any `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"` -} - -func (x *Error_Status) Reset() { -	*x = Error_Status{} -	if protoimpl.UnsafeEnabled { -		mi := &file_apierror_internal_proto_error_proto_msgTypes[1] -		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) -		ms.StoreMessageInfo(mi) -	} -} - -func (x *Error_Status) String() string { -	return protoimpl.X.MessageStringOf(x) -} - -func (*Error_Status) ProtoMessage() {} - -func (x *Error_Status) ProtoReflect() protoreflect.Message { -	mi := &file_apierror_internal_proto_error_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 Error_Status.ProtoReflect.Descriptor instead. -func (*Error_Status) Descriptor() ([]byte, []int) { -	return file_apierror_internal_proto_error_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Error_Status) GetCode() int32 { -	if x != nil { -		return x.Code -	} -	return 0 -} - -func (x *Error_Status) GetMessage() string { -	if x != nil { -		return x.Message -	} -	return "" -} - -func (x *Error_Status) GetStatus() code.Code { -	if x != nil { -		return x.Status -	} -	return code.Code(0) -} - -func (x *Error_Status) GetDetails() []*anypb.Any { -	if x != nil { -		return x.Details -	} -	return nil -} - -var File_apierror_internal_proto_error_proto protoreflect.FileDescriptor - -var file_apierror_internal_proto_error_proto_rawDesc = []byte{ -	0x0a, 0x23, 0x61, 0x70, 0x69, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, -	0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, -	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x65, 0x72, 0x72, 0x6f, 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, 0x15, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, -	0x72, 0x70, 0x63, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc5, -	0x01, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x29, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, -	0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, -	0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x65, 0x72, -	0x72, 0x6f, 0x72, 0x1a, 0x90, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, -	0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, -	0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, -	0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x28, 0x0a, 0x06, -	0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x67, -	0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x06, -	0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, -	0x73, 0x18, 0x05, 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, 0x07, 0x64, -	0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, -	0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f, -	0x67, 0x61, 0x78, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x69, 0x65, 0x72, 0x72, -	0x6f, 0x72, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, -	0x6f, 0x3b, 0x6a, 0x73, 0x6f, 0x6e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, -	0x74, 0x6f, 0x33, -} - -var ( -	file_apierror_internal_proto_error_proto_rawDescOnce sync.Once -	file_apierror_internal_proto_error_proto_rawDescData = file_apierror_internal_proto_error_proto_rawDesc -) - -func file_apierror_internal_proto_error_proto_rawDescGZIP() []byte { -	file_apierror_internal_proto_error_proto_rawDescOnce.Do(func() { -		file_apierror_internal_proto_error_proto_rawDescData = protoimpl.X.CompressGZIP(file_apierror_internal_proto_error_proto_rawDescData) -	}) -	return file_apierror_internal_proto_error_proto_rawDescData -} - -var file_apierror_internal_proto_error_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_apierror_internal_proto_error_proto_goTypes = []interface{}{ -	(*Error)(nil),        // 0: error.Error -	(*Error_Status)(nil), // 1: error.Error.Status -	(code.Code)(0),       // 2: google.rpc.Code -	(*anypb.Any)(nil),    // 3: google.protobuf.Any -} -var file_apierror_internal_proto_error_proto_depIdxs = []int32{ -	1, // 0: error.Error.error:type_name -> error.Error.Status -	2, // 1: error.Error.Status.status:type_name -> google.rpc.Code -	3, // 2: error.Error.Status.details: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_apierror_internal_proto_error_proto_init() } -func file_apierror_internal_proto_error_proto_init() { -	if File_apierror_internal_proto_error_proto != nil { -		return -	} -	if !protoimpl.UnsafeEnabled { -		file_apierror_internal_proto_error_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { -			switch v := v.(*Error); i { -			case 0: -				return &v.state -			case 1: -				return &v.sizeCache -			case 2: -				return &v.unknownFields -			default: -				return nil -			} -		} -		file_apierror_internal_proto_error_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { -			switch v := v.(*Error_Status); 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_apierror_internal_proto_error_proto_rawDesc, -			NumEnums:      0, -			NumMessages:   2, -			NumExtensions: 0, -			NumServices:   0, -		}, -		GoTypes:           file_apierror_internal_proto_error_proto_goTypes, -		DependencyIndexes: file_apierror_internal_proto_error_proto_depIdxs, -		MessageInfos:      file_apierror_internal_proto_error_proto_msgTypes, -	}.Build() -	File_apierror_internal_proto_error_proto = out.File -	file_apierror_internal_proto_error_proto_rawDesc = nil -	file_apierror_internal_proto_error_proto_goTypes = nil -	file_apierror_internal_proto_error_proto_depIdxs = nil -} diff --git a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/error.proto b/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/error.proto deleted file mode 100644 index 4b9b13c..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/apierror/internal/proto/error.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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 error; - -import "google/protobuf/any.proto"; -import "google/rpc/code.proto"; - -option go_package = "github.com/googleapis/gax-go/v2/apierror/internal/proto;jsonerror"; - -// The error format v2 for Google JSON REST APIs. -// Copied from https://cloud.google.com/apis/design/errors#http_mapping. -// -// NOTE: This schema is not used for other wire protocols. -message Error { -  // This message has the same semantics as `google.rpc.Status`. It uses HTTP -  // status code instead of gRPC status code. It has an extra field `status` -  // for backward compatibility with Google API Client Libraries. -  message Status { -    // The HTTP status code that corresponds to `google.rpc.Status.code`. -    int32 code = 1; -    // This corresponds to `google.rpc.Status.message`. -    string message = 2; -    // This is the enum version for `google.rpc.Status.code`. -    google.rpc.Code status = 4; -    // This corresponds to `google.rpc.Status.details`. -    repeated google.protobuf.Any details = 5; -  } -  // The actual error payload. The nested message structure is for backward -  // compatibility with Google API client libraries. It also makes the error -  // more readable to developers. -  Status error = 1; -} diff --git a/vendor/github.com/googleapis/gax-go/v2/call_option.go b/vendor/github.com/googleapis/gax-go/v2/call_option.go deleted file mode 100644 index e092005..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/call_option.go +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright 2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -//     * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -//     * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -//     * Neither the name of 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 gax - -import ( -	"errors" -	"math/rand" -	"time" - -	"google.golang.org/api/googleapi" -	"google.golang.org/grpc" -	"google.golang.org/grpc/codes" -	"google.golang.org/grpc/status" -) - -// CallOption is an option used by Invoke to control behaviors of RPC calls. -// CallOption works by modifying relevant fields of CallSettings. -type CallOption interface { -	// Resolve applies the option by modifying cs. -	Resolve(cs *CallSettings) -} - -// Retryer is used by Invoke to determine retry behavior. -type Retryer interface { -	// Retry reports whether a request should be retried and how long to pause before retrying -	// if the previous attempt returned with err. Invoke never calls Retry with nil error. -	Retry(err error) (pause time.Duration, shouldRetry bool) -} - -type retryerOption func() Retryer - -func (o retryerOption) Resolve(s *CallSettings) { -	s.Retry = o -} - -// WithRetry sets CallSettings.Retry to fn. -func WithRetry(fn func() Retryer) CallOption { -	return retryerOption(fn) -} - -// OnErrorFunc returns a Retryer that retries if and only if the previous attempt -// returns an error that satisfies shouldRetry. -// -// Pause times between retries are specified by bo. bo is only used for its -// parameters; each Retryer has its own copy. -func OnErrorFunc(bo Backoff, shouldRetry func(err error) bool) Retryer { -	return &errorRetryer{ -		shouldRetry: shouldRetry, -		backoff:     bo, -	} -} - -type errorRetryer struct { -	backoff     Backoff -	shouldRetry func(err error) bool -} - -func (r *errorRetryer) Retry(err error) (time.Duration, bool) { -	if r.shouldRetry(err) { -		return r.backoff.Pause(), true -	} - -	return 0, false -} - -// OnCodes returns a Retryer that retries if and only if -// the previous attempt returns a GRPC error whose error code is stored in cc. -// Pause times between retries are specified by bo. -// -// bo is only used for its parameters; each Retryer has its own copy. -func OnCodes(cc []codes.Code, bo Backoff) Retryer { -	return &boRetryer{ -		backoff: bo, -		codes:   append([]codes.Code(nil), cc...), -	} -} - -type boRetryer struct { -	backoff Backoff -	codes   []codes.Code -} - -func (r *boRetryer) Retry(err error) (time.Duration, bool) { -	st, ok := status.FromError(err) -	if !ok { -		return 0, false -	} -	c := st.Code() -	for _, rc := range r.codes { -		if c == rc { -			return r.backoff.Pause(), true -		} -	} -	return 0, false -} - -// OnHTTPCodes returns a Retryer that retries if and only if -// the previous attempt returns a googleapi.Error whose status code is stored in -// cc. Pause times between retries are specified by bo. -// -// bo is only used for its parameters; each Retryer has its own copy. -func OnHTTPCodes(bo Backoff, cc ...int) Retryer { -	codes := make(map[int]bool, len(cc)) -	for _, c := range cc { -		codes[c] = true -	} - -	return &httpRetryer{ -		backoff: bo, -		codes:   codes, -	} -} - -type httpRetryer struct { -	backoff Backoff -	codes   map[int]bool -} - -func (r *httpRetryer) Retry(err error) (time.Duration, bool) { -	var gerr *googleapi.Error -	if !errors.As(err, &gerr) { -		return 0, false -	} - -	if r.codes[gerr.Code] { -		return r.backoff.Pause(), true -	} - -	return 0, false -} - -// Backoff implements exponential backoff. The wait time between retries is a -// random value between 0 and the "retry period" - the time between retries. The -// retry period starts at Initial and increases by the factor of Multiplier -// every retry, but is capped at Max. -// -// Note: MaxNumRetries / RPCDeadline is specifically not provided. These should -// be built on top of Backoff. -type Backoff struct { -	// Initial is the initial value of the retry period, defaults to 1 second. -	Initial time.Duration - -	// Max is the maximum value of the retry period, defaults to 30 seconds. -	Max time.Duration - -	// Multiplier is the factor by which the retry period increases. -	// It should be greater than 1 and defaults to 2. -	Multiplier float64 - -	// cur is the current retry period. -	cur time.Duration -} - -// Pause returns the next time.Duration that the caller should use to backoff. -func (bo *Backoff) Pause() time.Duration { -	if bo.Initial == 0 { -		bo.Initial = time.Second -	} -	if bo.cur == 0 { -		bo.cur = bo.Initial -	} -	if bo.Max == 0 { -		bo.Max = 30 * time.Second -	} -	if bo.Multiplier < 1 { -		bo.Multiplier = 2 -	} -	// Select a duration between 1ns and the current max. It might seem -	// counterintuitive to have so much jitter, but -	// https://www.awsarchitectureblog.com/2015/03/backoff.html argues that -	// that is the best strategy. -	d := time.Duration(1 + rand.Int63n(int64(bo.cur))) -	bo.cur = time.Duration(float64(bo.cur) * bo.Multiplier) -	if bo.cur > bo.Max { -		bo.cur = bo.Max -	} -	return d -} - -type grpcOpt []grpc.CallOption - -func (o grpcOpt) Resolve(s *CallSettings) { -	s.GRPC = o -} - -type pathOpt struct { -	p string -} - -func (p pathOpt) Resolve(s *CallSettings) { -	s.Path = p.p -} - -// WithPath applies a Path override to the HTTP-based APICall. -// -// This is for internal use only. -func WithPath(p string) CallOption { -	return &pathOpt{p: p} -} - -// WithGRPCOptions allows passing gRPC call options during client creation. -func WithGRPCOptions(opt ...grpc.CallOption) CallOption { -	return grpcOpt(append([]grpc.CallOption(nil), opt...)) -} - -// CallSettings allow fine-grained control over how calls are made. -type CallSettings struct { -	// Retry returns a Retryer to be used to control retry logic of a method call. -	// If Retry is nil or the returned Retryer is nil, the call will not be retried. -	Retry func() Retryer - -	// CallOptions to be forwarded to GRPC. -	GRPC []grpc.CallOption - -	// Path is an HTTP override for an APICall. -	Path string -} diff --git a/vendor/github.com/googleapis/gax-go/v2/content_type.go b/vendor/github.com/googleapis/gax-go/v2/content_type.go deleted file mode 100644 index 1b53d0a..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/content_type.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2022, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -//     * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -//     * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -//     * Neither the name of 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 gax - -import ( -	"io" -	"io/ioutil" -	"net/http" -) - -const sniffBuffSize = 512 - -func newContentSniffer(r io.Reader) *contentSniffer { -	return &contentSniffer{r: r} -} - -// contentSniffer wraps a Reader, and reports the content type determined by sniffing up to 512 bytes from the Reader. -type contentSniffer struct { -	r     io.Reader -	start []byte // buffer for the sniffed bytes. -	err   error  // set to any error encountered while reading bytes to be sniffed. - -	ctype   string // set on first sniff. -	sniffed bool   // set to true on first sniff. -} - -func (cs *contentSniffer) Read(p []byte) (n int, err error) { -	// Ensure that the content type is sniffed before any data is consumed from Reader. -	_, _ = cs.ContentType() - -	if len(cs.start) > 0 { -		n := copy(p, cs.start) -		cs.start = cs.start[n:] -		return n, nil -	} - -	// We may have read some bytes into start while sniffing, even if the read ended in an error. -	// We should first return those bytes, then the error. -	if cs.err != nil { -		return 0, cs.err -	} - -	// Now we have handled all bytes that were buffered while sniffing.  Now just delegate to the underlying reader. -	return cs.r.Read(p) -} - -// ContentType returns the sniffed content type, and whether the content type was successfully sniffed. -func (cs *contentSniffer) ContentType() (string, bool) { -	if cs.sniffed { -		return cs.ctype, cs.ctype != "" -	} -	cs.sniffed = true -	// If ReadAll hits EOF, it returns err==nil. -	cs.start, cs.err = ioutil.ReadAll(io.LimitReader(cs.r, sniffBuffSize)) - -	// Don't try to detect the content type based on possibly incomplete data. -	if cs.err != nil { -		return "", false -	} - -	cs.ctype = http.DetectContentType(cs.start) -	return cs.ctype, true -} - -// DetermineContentType determines the content type of the supplied reader. -// The content of media will be sniffed to determine the content type. -// After calling DetectContentType the caller must not perform further reads on -// media, but rather read from the Reader that is returned. -func DetermineContentType(media io.Reader) (io.Reader, string) { -	// For backwards compatibility, allow clients to set content -	// type by providing a ContentTyper for media. -	// Note: This is an anonymous interface definition copied from googleapi.ContentTyper. -	if typer, ok := media.(interface { -		ContentType() string -	}); ok { -		return media, typer.ContentType() -	} - -	sniffer := newContentSniffer(media) -	if ctype, ok := sniffer.ContentType(); ok { -		return sniffer, ctype -	} -	// If content type could not be sniffed, reads from sniffer will eventually fail with an error. -	return sniffer, "" -} diff --git a/vendor/github.com/googleapis/gax-go/v2/gax.go b/vendor/github.com/googleapis/gax-go/v2/gax.go deleted file mode 100644 index 36cdfa3..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/gax.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -//     * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -//     * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -//     * Neither the name of 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 gax contains a set of modules which aid the development of APIs -// for clients and servers based on gRPC and Google API conventions. -// -// Application code will rarely need to use this library directly. -// However, code generated automatically from API definition files can use it -// to simplify code generation and to provide more convenient and idiomatic API surfaces. -package gax - -import "github.com/googleapis/gax-go/v2/internal" - -// Version specifies the gax-go version being used. -const Version = internal.Version diff --git a/vendor/github.com/googleapis/gax-go/v2/header.go b/vendor/github.com/googleapis/gax-go/v2/header.go deleted file mode 100644 index 139371a..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/header.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2018, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -//     * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -//     * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -//     * Neither the name of 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 gax - -import "bytes" - -// XGoogHeader is for use by the Google Cloud Libraries only. -// -// XGoogHeader formats key-value pairs. -// The resulting string is suitable for x-goog-api-client header. -func XGoogHeader(keyval ...string) string { -	if len(keyval) == 0 { -		return "" -	} -	if len(keyval)%2 != 0 { -		panic("gax.Header: odd argument count") -	} -	var buf bytes.Buffer -	for i := 0; i < len(keyval); i += 2 { -		buf.WriteByte(' ') -		buf.WriteString(keyval[i]) -		buf.WriteByte('/') -		buf.WriteString(keyval[i+1]) -	} -	return buf.String()[1:] -} diff --git a/vendor/github.com/googleapis/gax-go/v2/internal/version.go b/vendor/github.com/googleapis/gax-go/v2/internal/version.go deleted file mode 100644 index 936873e..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/internal/version.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -//     * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -//     * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -//     * Neither the name of 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 internal - -// Version is the current tagged release of the library. -const Version = "2.7.1" diff --git a/vendor/github.com/googleapis/gax-go/v2/invoke.go b/vendor/github.com/googleapis/gax-go/v2/invoke.go deleted file mode 100644 index 9fcc299..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/invoke.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -//     * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -//     * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -//     * Neither the name of 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 gax - -import ( -	"context" -	"strings" -	"time" - -	"github.com/googleapis/gax-go/v2/apierror" -) - -// APICall is a user defined call stub. -type APICall func(context.Context, CallSettings) error - -// Invoke calls the given APICall, performing retries as specified by opts, if -// any. -func Invoke(ctx context.Context, call APICall, opts ...CallOption) error { -	var settings CallSettings -	for _, opt := range opts { -		opt.Resolve(&settings) -	} -	return invoke(ctx, call, settings, Sleep) -} - -// Sleep is similar to time.Sleep, but it can be interrupted by ctx.Done() closing. -// If interrupted, Sleep returns ctx.Err(). -func Sleep(ctx context.Context, d time.Duration) error { -	t := time.NewTimer(d) -	select { -	case <-ctx.Done(): -		t.Stop() -		return ctx.Err() -	case <-t.C: -		return nil -	} -} - -type sleeper func(ctx context.Context, d time.Duration) error - -// invoke implements Invoke, taking an additional sleeper argument for testing. -func invoke(ctx context.Context, call APICall, settings CallSettings, sp sleeper) error { -	var retryer Retryer -	for { -		err := call(ctx, settings) -		if err == nil { -			return nil -		} -		// Never retry permanent certificate errors. (e.x. if ca-certificates -		// are not installed). We should only make very few, targeted -		// exceptions: many (other) status=Unavailable should be retried, such -		// as if there's a network hiccup, or the internet goes out for a -		// minute. This is also why here we are doing string parsing instead of -		// simply making Unavailable a non-retried code elsewhere. -		if strings.Contains(err.Error(), "x509: certificate signed by unknown authority") { -			return err -		} -		if apierr, ok := apierror.FromError(err); ok { -			err = apierr -		} -		if settings.Retry == nil { -			return err -		} -		if retryer == nil { -			if r := settings.Retry(); r != nil { -				retryer = r -			} else { -				return err -			} -		} -		if d, ok := retryer.Retry(err); !ok { -			return err -		} else if err = sp(ctx, d); err != nil { -			return err -		} -	} -} diff --git a/vendor/github.com/googleapis/gax-go/v2/proto_json_stream.go b/vendor/github.com/googleapis/gax-go/v2/proto_json_stream.go deleted file mode 100644 index cc4486e..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/proto_json_stream.go +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2022, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -//     * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -//     * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -//     * Neither the name of 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 gax - -import ( -	"encoding/json" -	"errors" -	"io" - -	"google.golang.org/protobuf/encoding/protojson" -	"google.golang.org/protobuf/proto" -	"google.golang.org/protobuf/reflect/protoreflect" -) - -var ( -	arrayOpen     = json.Delim('[') -	arrayClose    = json.Delim(']') -	errBadOpening = errors.New("unexpected opening token, expected '['") -) - -// ProtoJSONStream represents a wrapper for consuming a stream of protobuf -// messages encoded using protobuf-JSON format. More information on this format -// can be found at https://developers.google.com/protocol-buffers/docs/proto3#json. -// The stream must appear as a comma-delimited, JSON array of obbjects with -// opening and closing square braces. -// -// This is for internal use only. -type ProtoJSONStream struct { -	first, closed bool -	reader        io.ReadCloser -	stream        *json.Decoder -	typ           protoreflect.MessageType -} - -// NewProtoJSONStreamReader accepts a stream of bytes via an io.ReadCloser that are -// protobuf-JSON encoded protobuf messages of the given type. The ProtoJSONStream -// must be closed when done. -// -// This is for internal use only. -func NewProtoJSONStreamReader(rc io.ReadCloser, typ protoreflect.MessageType) *ProtoJSONStream { -	return &ProtoJSONStream{ -		first:  true, -		reader: rc, -		stream: json.NewDecoder(rc), -		typ:    typ, -	} -} - -// Recv decodes the next protobuf message in the stream or returns io.EOF if -// the stream is done. It is not safe to call Recv on the same stream from -// different goroutines, just like it is not safe to do so with a single gRPC -// stream. Type-cast the protobuf message returned to the type provided at -// ProtoJSONStream creation. -// Calls to Recv after calling Close will produce io.EOF. -func (s *ProtoJSONStream) Recv() (proto.Message, error) { -	if s.closed { -		return nil, io.EOF -	} -	if s.first { -		s.first = false - -		// Consume the opening '[' so Decode gets one object at a time. -		if t, err := s.stream.Token(); err != nil { -			return nil, err -		} else if t != arrayOpen { -			return nil, errBadOpening -		} -	} - -	// Capture the next block of data for the item (a JSON object) in the stream. -	var raw json.RawMessage -	if err := s.stream.Decode(&raw); err != nil { -		e := err -		// To avoid checking the first token of each stream, just attempt to -		// Decode the next blob and if that fails, double check if it is just -		// the closing token ']'. If it is the closing, return io.EOF. If it -		// isn't, return the original error. -		if t, _ := s.stream.Token(); t == arrayClose { -			e = io.EOF -		} -		return nil, e -	} - -	// Initialize a new instance of the protobuf message to unmarshal the -	// raw data into. -	m := s.typ.New().Interface() -	err := protojson.Unmarshal(raw, m) - -	return m, err -} - -// Close closes the stream so that resources are cleaned up. -func (s *ProtoJSONStream) Close() error { -	// Dereference the *json.Decoder so that the memory is gc'd. -	s.stream = nil -	s.closed = true - -	return s.reader.Close() -} diff --git a/vendor/github.com/googleapis/gax-go/v2/release-please-config.json b/vendor/github.com/googleapis/gax-go/v2/release-please-config.json deleted file mode 100644 index 61ee266..0000000 --- a/vendor/github.com/googleapis/gax-go/v2/release-please-config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ -    "release-type": "go-yoshi", -    "separate-pull-requests": true, -    "include-component-in-tag": false, -    "packages": { -        "v2": { -            "component": "v2" -        } -    } -}  | 
