summaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/protobuf/reflect/protoreflect
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-09-23 08:19:05 -0700
committerJhon Honce <jhonce@redhat.com>2020-09-29 08:46:44 -0700
commit5aead1509c681de533b8966e781e15327fe35ab6 (patch)
tree8ba86faa76299b04e902b3bf11c5b7ce9872192a /vendor/google.golang.org/protobuf/reflect/protoreflect
parent2ee415be90b8d6ab75f9fe579fc1b8690e023d3c (diff)
downloadpodman-5aead1509c681de533b8966e781e15327fe35ab6.tar.gz
podman-5aead1509c681de533b8966e781e15327fe35ab6.tar.bz2
podman-5aead1509c681de533b8966e781e15327fe35ab6.zip
Add X-Registry-Config support
* Refactor auth pkg to support X-Registry-Config * Refactor build endpoint to support X-Registry-Config. Supports: * --creds * --authfile * Added X-Reference-Id Header to http.Request to support log event correlation * Log headers from http.Request Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'vendor/google.golang.org/protobuf/reflect/protoreflect')
-rw-r--r--vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go50
1 files changed, 38 insertions, 12 deletions
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
index b669a4e76..dd85915bd 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
@@ -128,7 +128,6 @@ package protoreflect
import (
"fmt"
- "regexp"
"strings"
"google.golang.org/protobuf/encoding/protowire"
@@ -408,19 +407,14 @@ type EnumRanges interface {
doNotImplement
}
-var (
- regexName = regexp.MustCompile(`^[_a-zA-Z][_a-zA-Z0-9]*$`)
- regexFullName = regexp.MustCompile(`^[_a-zA-Z][_a-zA-Z0-9]*(\.[_a-zA-Z][_a-zA-Z0-9]*)*$`)
-)
-
// Name is the short name for a proto declaration. This is not the name
// as used in Go source code, which might not be identical to the proto name.
type Name string // e.g., "Kind"
-// IsValid reports whether n is a syntactically valid name.
+// IsValid reports whether s is a syntactically valid name.
// An empty name is invalid.
-func (n Name) IsValid() bool {
- return regexName.MatchString(string(n))
+func (s Name) IsValid() bool {
+ return consumeIdent(string(s)) == len(s)
}
// Names represent a list of names.
@@ -443,10 +437,42 @@ type Names interface {
// This should not have any leading or trailing dots.
type FullName string // e.g., "google.protobuf.Field.Kind"
-// IsValid reports whether n is a syntactically valid full name.
+// IsValid reports whether s is a syntactically valid full name.
// An empty full name is invalid.
-func (n FullName) IsValid() bool {
- return regexFullName.MatchString(string(n))
+func (s FullName) IsValid() bool {
+ i := consumeIdent(string(s))
+ if i < 0 {
+ return false
+ }
+ for len(s) > i {
+ if s[i] != '.' {
+ return false
+ }
+ i++
+ n := consumeIdent(string(s[i:]))
+ if n < 0 {
+ return false
+ }
+ i += n
+ }
+ return true
+}
+
+func consumeIdent(s string) (i int) {
+ if len(s) == 0 || !isLetter(s[i]) {
+ return -1
+ }
+ i++
+ for len(s) > i && isLetterDigit(s[i]) {
+ i++
+ }
+ return i
+}
+func isLetter(c byte) bool {
+ return c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
+}
+func isLetterDigit(c byte) bool {
+ return isLetter(c) || ('0' <= c && c <= '9')
}
// Name returns the short name, which is the last identifier segment.