github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/extensions/http/original_ip_detection/xff/v3/xff.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/extensions/http/original_ip_detection/xff/v3/xff.proto 3 4 package envoy_extensions_http_original_ip_detection_xff_v3 5 6 import ( 7 "bytes" 8 "errors" 9 "fmt" 10 "net" 11 "net/mail" 12 "net/url" 13 "regexp" 14 "strings" 15 "time" 16 "unicode/utf8" 17 18 "google.golang.org/protobuf/types/known/anypb" 19 ) 20 21 // ensure the imports are used 22 var ( 23 _ = bytes.MinRead 24 _ = errors.New("") 25 _ = fmt.Print 26 _ = utf8.UTFMax 27 _ = (*regexp.Regexp)(nil) 28 _ = (*strings.Reader)(nil) 29 _ = net.IPv4len 30 _ = time.Duration(0) 31 _ = (*url.URL)(nil) 32 _ = (*mail.Address)(nil) 33 _ = anypb.Any{} 34 ) 35 36 // Validate checks the field values on XffConfig with the rules defined in the 37 // proto definition for this message. If any rules are violated, an error is returned. 38 func (m *XffConfig) Validate() error { 39 if m == nil { 40 return nil 41 } 42 43 // no validation rules for XffNumTrustedHops 44 45 return nil 46 } 47 48 // XffConfigValidationError is the validation error returned by 49 // XffConfig.Validate if the designated constraints aren't met. 50 type XffConfigValidationError struct { 51 field string 52 reason string 53 cause error 54 key bool 55 } 56 57 // Field function returns field value. 58 func (e XffConfigValidationError) Field() string { return e.field } 59 60 // Reason function returns reason value. 61 func (e XffConfigValidationError) Reason() string { return e.reason } 62 63 // Cause function returns cause value. 64 func (e XffConfigValidationError) Cause() error { return e.cause } 65 66 // Key function returns key value. 67 func (e XffConfigValidationError) Key() bool { return e.key } 68 69 // ErrorName returns error name. 70 func (e XffConfigValidationError) ErrorName() string { return "XffConfigValidationError" } 71 72 // Error satisfies the builtin error interface 73 func (e XffConfigValidationError) Error() string { 74 cause := "" 75 if e.cause != nil { 76 cause = fmt.Sprintf(" | caused by: %v", e.cause) 77 } 78 79 key := "" 80 if e.key { 81 key = "key for " 82 } 83 84 return fmt.Sprintf( 85 "invalid %sXffConfig.%s: %s%s", 86 key, 87 e.field, 88 e.reason, 89 cause) 90 } 91 92 var _ error = XffConfigValidationError{} 93 94 var _ interface { 95 Field() string 96 Reason() string 97 Key() bool 98 Cause() error 99 ErrorName() string 100 } = XffConfigValidationError{}