Merge pull request #8385 from hashicorp/dnephin/check-generated

ci: Add check-generated-protobuf
This commit is contained in:
Daniel Nephin 2020-08-05 12:10:27 -04:00 committed by hashicorp-ci
parent 622495fd28
commit e5f5588d9d
9 changed files with 1044 additions and 871 deletions

View File

@ -85,6 +85,36 @@ jobs:
exit 1 exit 1
fi fi
check-generated-protobuf:
docker:
- image: *GOLANG_IMAGE
environment:
<<: *ENVIRONMENT
steps:
- checkout
- run:
name: Install protobuf
command: |
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/protoc-3.12.3-linux-x86_64.zip
sudo unzip -d /usr/local protoc-*.zip
sudo chmod +x /usr/local/bin/protoc
rm protoc-*.zip
- run:
name: Install gogo/protobuf
command: |
gogo_version=$(go list -m github.com/gogo/protobuf | awk '{print $2}')
mkdir -p .gotools; cd .gotools; go mod init consul-tools
go get -v github.com/hashicorp/protoc-gen-go-binary
go get -v github.com/gogo/protobuf/protoc-gen-gofast@${gogo_version}
- run:
command: make --always-make proto
- run: |
if ! git diff --exit-code; then
echo "Generated code was not updated correctly"
exit 1
fi
go-test: go-test:
docker: docker:
- image: *GOLANG_IMAGE - image: *GOLANG_IMAGE
@ -629,6 +659,7 @@ workflows:
- stable-website - stable-website
- /^docs\/.*/ - /^docs\/.*/
- /^ui\/.*/ - /^ui\/.*/
- check-generated-protobuf: *filter-ignore-non-go-branches
- lint-consul-retry: *filter-ignore-non-go-branches - lint-consul-retry: *filter-ignore-non-go-branches
- lint: *filter-ignore-non-go-branches - lint: *filter-ignore-non-go-branches
- test-connect-ca-providers: *filter-ignore-non-go-branches - test-connect-ca-providers: *filter-ignore-non-go-branches

View File

@ -363,14 +363,6 @@ else
@go test -v ./agent/connect/ca @go test -v ./agent/connect/ca
endif endif
proto-delete:
@echo "Removing $(PROTOGOFILES)"
-@rm $(PROTOGOFILES)
@echo "Removing $(PROTOGOBINFILES)"
-@rm $(PROTOGOBINFILES)
proto-rebuild: proto-delete proto
proto: $(PROTOGOFILES) $(PROTOGOBINFILES) proto: $(PROTOGOFILES) $(PROTOGOBINFILES)
@echo "Generated all protobuf Go files" @echo "Generated all protobuf Go files"
@ -381,4 +373,4 @@ proto: $(PROTOGOFILES) $(PROTOGOBINFILES)
.PHONY: all ci bin dev dist cov test test-flake test-internal cover lint ui static-assets tools .PHONY: all ci bin dev dist cov test test-flake test-internal cover lint ui static-assets tools
.PHONY: docker-images go-build-image ui-build-image static-assets-docker consul-docker ui-docker .PHONY: docker-images go-build-image ui-build-image static-assets-docker consul-docker ui-docker
.PHONY: version proto proto-rebuild proto-delete test-envoy-integ .PHONY: version proto test-envoy-integ

View File

@ -116,7 +116,7 @@ function main {
return 1 return 1
fi fi
BUILD_TAGS=$(sed -e '/^[:space:]*$/,$d' < "${proto_path}" | grep '// +build') BUILD_TAGS=$(sed -e '/^[[:space:]]*$/,$d' < "${proto_path}" | grep '// +build')
if test -n "${BUILD_TAGS}" if test -n "${BUILD_TAGS}"
then then
echo -e "${BUILD_TAGS}\n" >> "${proto_go_path}.new" echo -e "${BUILD_TAGS}\n" >> "${proto_go_path}.new"

View File

@ -9,6 +9,7 @@ import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -41,7 +42,7 @@ func (m *ACLLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ACLLink.Marshal(b, m, deterministic) return xxx_messageInfo_ACLLink.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -86,7 +87,7 @@ var fileDescriptor_ad2d2c73a6a0d8b5 = []byte{
func (m *ACLLink) Marshal() (dAtA []byte, err error) { func (m *ACLLink) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -94,33 +95,42 @@ func (m *ACLLink) Marshal() (dAtA []byte, err error) {
} }
func (m *ACLLink) MarshalTo(dAtA []byte) (int, error) { func (m *ACLLink) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ACLLink) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintAcl(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if len(m.Name) > 0 { if len(m.Name) > 0 {
dAtA[i] = 0x12 i -= len(m.Name)
i++ copy(dAtA[i:], m.Name)
i = encodeVarintAcl(dAtA, i, uint64(len(m.Name))) i = encodeVarintAcl(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name) i--
dAtA[i] = 0x12
} }
return i, nil if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintAcl(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintAcl(dAtA []byte, offset int, v uint64) int { func encodeVarintAcl(dAtA []byte, offset int, v uint64) int {
offset -= sovAcl(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *ACLLink) Size() (n int) { func (m *ACLLink) Size() (n int) {
if m == nil { if m == nil {
@ -140,14 +150,7 @@ func (m *ACLLink) Size() (n int) {
} }
func sovAcl(x uint64) (n int) { func sovAcl(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozAcl(x uint64) (n int) { func sozAcl(x uint64) (n int) {
return sovAcl(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovAcl(uint64((x << 1) ^ uint64((int64(x) >> 63))))

View File

@ -10,6 +10,7 @@ import (
pbconnect "github.com/hashicorp/consul/proto/pbconnect" pbconnect "github.com/hashicorp/consul/proto/pbconnect"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -63,7 +64,7 @@ func (m *AutoConfigRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e
return xxx_messageInfo_AutoConfigRequest.Marshal(b, m, deterministic) return xxx_messageInfo_AutoConfigRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -154,7 +155,7 @@ func (m *AutoConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_AutoConfigResponse.Marshal(b, m, deterministic) return xxx_messageInfo_AutoConfigResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -239,7 +240,7 @@ var fileDescriptor_ccc5af992e5daf69 = []byte{
func (m *AutoConfigRequest) Marshal() (dAtA []byte, err error) { func (m *AutoConfigRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -247,56 +248,68 @@ func (m *AutoConfigRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *AutoConfigRequest) MarshalTo(dAtA []byte) (int, error) { func (m *AutoConfigRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AutoConfigRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Datacenter) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.Datacenter)))
i += copy(dAtA[i:], m.Datacenter)
}
if len(m.Node) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.Node)))
i += copy(dAtA[i:], m.Node)
}
if len(m.Segment) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.Segment)))
i += copy(dAtA[i:], m.Segment)
}
if len(m.JWT) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.JWT)))
i += copy(dAtA[i:], m.JWT)
}
if len(m.ConsulToken) > 0 {
dAtA[i] = 0x32
i++
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.ConsulToken)))
i += copy(dAtA[i:], m.ConsulToken)
} }
if len(m.CSR) > 0 { if len(m.CSR) > 0 {
dAtA[i] = 0x3a i -= len(m.CSR)
i++ copy(dAtA[i:], m.CSR)
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.CSR))) i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.CSR)))
i += copy(dAtA[i:], m.CSR) i--
dAtA[i] = 0x3a
} }
if m.XXX_unrecognized != nil { if len(m.ConsulToken) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ConsulToken)
copy(dAtA[i:], m.ConsulToken)
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.ConsulToken)))
i--
dAtA[i] = 0x32
} }
return i, nil if len(m.JWT) > 0 {
i -= len(m.JWT)
copy(dAtA[i:], m.JWT)
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.JWT)))
i--
dAtA[i] = 0x2a
}
if len(m.Segment) > 0 {
i -= len(m.Segment)
copy(dAtA[i:], m.Segment)
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.Segment)))
i--
dAtA[i] = 0x22
}
if len(m.Node) > 0 {
i -= len(m.Node)
copy(dAtA[i:], m.Node)
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.Node)))
i--
dAtA[i] = 0x12
}
if len(m.Datacenter) > 0 {
i -= len(m.Datacenter)
copy(dAtA[i:], m.Datacenter)
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.Datacenter)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *AutoConfigResponse) Marshal() (dAtA []byte, err error) { func (m *AutoConfigResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -304,69 +317,77 @@ func (m *AutoConfigResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *AutoConfigResponse) MarshalTo(dAtA []byte) (int, error) { func (m *AutoConfigResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AutoConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Config != nil { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintAutoConfig(dAtA, i, uint64(m.Config.Size()))
n1, err := m.Config.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
if m.CARoots != nil {
dAtA[i] = 0x12
i++
i = encodeVarintAutoConfig(dAtA, i, uint64(m.CARoots.Size()))
n2, err := m.CARoots.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
if m.Certificate != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintAutoConfig(dAtA, i, uint64(m.Certificate.Size()))
n3, err := m.Certificate.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
} }
if len(m.ExtraCACertificates) > 0 { if len(m.ExtraCACertificates) > 0 {
for _, s := range m.ExtraCACertificates { for iNdEx := len(m.ExtraCACertificates) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.ExtraCACertificates[iNdEx])
copy(dAtA[i:], m.ExtraCACertificates[iNdEx])
i = encodeVarintAutoConfig(dAtA, i, uint64(len(m.ExtraCACertificates[iNdEx])))
i--
dAtA[i] = 0x22 dAtA[i] = 0x22
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
} }
if m.XXX_unrecognized != nil { if m.Certificate != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) {
size, err := m.Certificate.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAutoConfig(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
} }
return i, nil if m.CARoots != nil {
{
size, err := m.CARoots.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAutoConfig(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if m.Config != nil {
{
size, err := m.Config.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAutoConfig(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintAutoConfig(dAtA []byte, offset int, v uint64) int { func encodeVarintAutoConfig(dAtA []byte, offset int, v uint64) int {
offset -= sovAutoConfig(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *AutoConfigRequest) Size() (n int) { func (m *AutoConfigRequest) Size() (n int) {
if m == nil { if m == nil {
@ -435,14 +456,7 @@ func (m *AutoConfigResponse) Size() (n int) {
} }
func sovAutoConfig(x uint64) (n int) { func sovAutoConfig(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozAutoConfig(x uint64) (n int) { func sozAutoConfig(x uint64) (n int) {
return sovAutoConfig(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovAutoConfig(uint64((x << 1) ^ uint64((int64(x) >> 63))))

View File

@ -11,6 +11,7 @@ import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
time "time" time "time"
) )
@ -47,7 +48,7 @@ func (m *RaftIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RaftIndex.Marshal(b, m, deterministic) return xxx_messageInfo_RaftIndex.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -86,7 +87,7 @@ func (m *TargetDatacenter) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
return xxx_messageInfo_TargetDatacenter.Marshal(b, m, deterministic) return xxx_messageInfo_TargetDatacenter.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -125,7 +126,7 @@ func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic) return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -218,7 +219,7 @@ func (m *QueryOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_QueryOptions.Marshal(b, m, deterministic) return xxx_messageInfo_QueryOptions.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -345,7 +346,7 @@ func (m *QueryMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryMeta.Marshal(b, m, deterministic) return xxx_messageInfo_QueryMeta.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -445,7 +446,7 @@ var fileDescriptor_a6f5ac44994d718c = []byte{
func (m *RaftIndex) Marshal() (dAtA []byte, err error) { func (m *RaftIndex) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -453,27 +454,32 @@ func (m *RaftIndex) Marshal() (dAtA []byte, err error) {
} }
func (m *RaftIndex) MarshalTo(dAtA []byte) (int, error) { func (m *RaftIndex) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *RaftIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.CreateIndex != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintCommon(dAtA, i, uint64(m.CreateIndex))
}
if m.ModifyIndex != 0 { if m.ModifyIndex != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintCommon(dAtA, i, uint64(m.ModifyIndex)) i = encodeVarintCommon(dAtA, i, uint64(m.ModifyIndex))
i--
dAtA[i] = 0x10
} }
return i, nil if m.CreateIndex != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.CreateIndex))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func (m *TargetDatacenter) Marshal() (dAtA []byte, err error) { func (m *TargetDatacenter) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -481,23 +487,29 @@ func (m *TargetDatacenter) Marshal() (dAtA []byte, err error) {
} }
func (m *TargetDatacenter) MarshalTo(dAtA []byte) (int, error) { func (m *TargetDatacenter) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TargetDatacenter) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Datacenter) > 0 { if len(m.Datacenter) > 0 {
dAtA[i] = 0xa i -= len(m.Datacenter)
i++ copy(dAtA[i:], m.Datacenter)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Datacenter))) i = encodeVarintCommon(dAtA, i, uint64(len(m.Datacenter)))
i += copy(dAtA[i:], m.Datacenter) i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *WriteRequest) Marshal() (dAtA []byte, err error) { func (m *WriteRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -505,23 +517,29 @@ func (m *WriteRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) { func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Token) > 0 { if len(m.Token) > 0 {
dAtA[i] = 0xa i -= len(m.Token)
i++ copy(dAtA[i:], m.Token)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token))) i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
i += copy(dAtA[i:], m.Token) i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *QueryOptions) Marshal() (dAtA []byte, err error) { func (m *QueryOptions) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -529,106 +547,113 @@ func (m *QueryOptions) Marshal() (dAtA []byte, err error) {
} }
func (m *QueryOptions) MarshalTo(dAtA []byte) (int, error) { func (m *QueryOptions) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Token) > 0 { if len(m.Filter) > 0 {
dAtA[i] = 0xa i -= len(m.Filter)
i++ copy(dAtA[i:], m.Filter)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token))) i = encodeVarintCommon(dAtA, i, uint64(len(m.Filter)))
i += copy(dAtA[i:], m.Token) i--
dAtA[i] = 0x5a
} }
if m.MinQueryIndex != 0 { n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.StaleIfError, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.StaleIfError):])
dAtA[i] = 0x10 if err1 != nil {
i++ return 0, err1
i = encodeVarintCommon(dAtA, i, uint64(m.MinQueryIndex))
} }
dAtA[i] = 0x1a i -= n1
i++ i = encodeVarintCommon(dAtA, i, uint64(n1))
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxQueryTime))) i--
n1, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxQueryTime, dAtA[i:]) dAtA[i] = 0x52
if err != nil {
return 0, err
}
i += n1
if m.AllowStale {
dAtA[i] = 0x20
i++
if m.AllowStale {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
if m.RequireConsistent {
dAtA[i] = 0x28
i++
if m.RequireConsistent {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
if m.UseCache {
dAtA[i] = 0x30
i++
if m.UseCache {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
dAtA[i] = 0x3a
i++
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxStaleDuration)))
n2, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxStaleDuration, dAtA[i:])
if err != nil {
return 0, err
}
i += n2
dAtA[i] = 0x42
i++
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAge)))
n3, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAge, dAtA[i:])
if err != nil {
return 0, err
}
i += n3
if m.MustRevalidate { if m.MustRevalidate {
dAtA[i] = 0x48 i--
i++
if m.MustRevalidate { if m.MustRevalidate {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x48
} }
dAtA[i] = 0x52 n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAge, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAge):])
i++ if err2 != nil {
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.StaleIfError))) return 0, err2
n4, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.StaleIfError, dAtA[i:])
if err != nil {
return 0, err
} }
i += n4 i -= n2
if len(m.Filter) > 0 { i = encodeVarintCommon(dAtA, i, uint64(n2))
dAtA[i] = 0x5a i--
i++ dAtA[i] = 0x42
i = encodeVarintCommon(dAtA, i, uint64(len(m.Filter))) n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxStaleDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxStaleDuration):])
i += copy(dAtA[i:], m.Filter) if err3 != nil {
return 0, err3
} }
return i, nil i -= n3
i = encodeVarintCommon(dAtA, i, uint64(n3))
i--
dAtA[i] = 0x3a
if m.UseCache {
i--
if m.UseCache {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x30
}
if m.RequireConsistent {
i--
if m.RequireConsistent {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x28
}
if m.AllowStale {
i--
if m.AllowStale {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxQueryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxQueryTime):])
if err4 != nil {
return 0, err4
}
i -= n4
i = encodeVarintCommon(dAtA, i, uint64(n4))
i--
dAtA[i] = 0x1a
if m.MinQueryIndex != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.MinQueryIndex))
i--
dAtA[i] = 0x10
}
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *QueryMeta) Marshal() (dAtA []byte, err error) { func (m *QueryMeta) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -636,50 +661,58 @@ func (m *QueryMeta) Marshal() (dAtA []byte, err error) {
} }
func (m *QueryMeta) MarshalTo(dAtA []byte) (int, error) { func (m *QueryMeta) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Index != 0 { if len(m.ConsistencyLevel) > 0 {
dAtA[i] = 0x8 i -= len(m.ConsistencyLevel)
i++ copy(dAtA[i:], m.ConsistencyLevel)
i = encodeVarintCommon(dAtA, i, uint64(m.Index)) i = encodeVarintCommon(dAtA, i, uint64(len(m.ConsistencyLevel)))
i--
dAtA[i] = 0x22
} }
dAtA[i] = 0x12
i++
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.LastContact)))
n5, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LastContact, dAtA[i:])
if err != nil {
return 0, err
}
i += n5
if m.KnownLeader { if m.KnownLeader {
dAtA[i] = 0x18 i--
i++
if m.KnownLeader { if m.KnownLeader {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x18
} }
if len(m.ConsistencyLevel) > 0 { n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LastContact, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LastContact):])
dAtA[i] = 0x22 if err5 != nil {
i++ return 0, err5
i = encodeVarintCommon(dAtA, i, uint64(len(m.ConsistencyLevel)))
i += copy(dAtA[i:], m.ConsistencyLevel)
} }
return i, nil i -= n5
i = encodeVarintCommon(dAtA, i, uint64(n5))
i--
dAtA[i] = 0x12
if m.Index != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.Index))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func encodeVarintCommon(dAtA []byte, offset int, v uint64) int { func encodeVarintCommon(dAtA []byte, offset int, v uint64) int {
offset -= sovCommon(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *RaftIndex) Size() (n int) { func (m *RaftIndex) Size() (n int) {
if m == nil { if m == nil {
@ -784,14 +817,7 @@ func (m *QueryMeta) Size() (n int) {
} }
func sovCommon(x uint64) (n int) { func sovCommon(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozCommon(x uint64) (n int) { func sozCommon(x uint64) (n int) {
return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63))))

View File

@ -10,6 +10,7 @@ import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -43,7 +44,7 @@ func (m *EnterpriseMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_EnterpriseMeta.Marshal(b, m, deterministic) return xxx_messageInfo_EnterpriseMeta.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -83,7 +84,7 @@ var fileDescriptor_8f9d7cd54dd4e173 = []byte{
func (m *EnterpriseMeta) Marshal() (dAtA []byte, err error) { func (m *EnterpriseMeta) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -91,24 +92,32 @@ func (m *EnterpriseMeta) Marshal() (dAtA []byte, err error) {
} }
func (m *EnterpriseMeta) MarshalTo(dAtA []byte) (int, error) { func (m *EnterpriseMeta) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EnterpriseMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintCommonOss(dAtA []byte, offset int, v uint64) int { func encodeVarintCommonOss(dAtA []byte, offset int, v uint64) int {
offset -= sovCommonOss(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *EnterpriseMeta) Size() (n int) { func (m *EnterpriseMeta) Size() (n int) {
if m == nil { if m == nil {
@ -123,14 +132,7 @@ func (m *EnterpriseMeta) Size() (n int) {
} }
func sovCommonOss(x uint64) (n int) { func sovCommonOss(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozCommonOss(x uint64) (n int) { func sozCommonOss(x uint64) (n int) {
return sovCommonOss(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovCommonOss(uint64((x << 1) ^ uint64((int64(x) >> 63))))

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@ import (
pbcommon "github.com/hashicorp/consul/proto/pbcommon" pbcommon "github.com/hashicorp/consul/proto/pbcommon"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -76,7 +77,7 @@ func (m *CARoots) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CARoots.Marshal(b, m, deterministic) return xxx_messageInfo_CARoots.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -194,7 +195,7 @@ func (m *CARoot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CARoot.Marshal(b, m, deterministic) return xxx_messageInfo_CARoot.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -368,7 +369,7 @@ func (m *IssuedCert) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_IssuedCert.Marshal(b, m, deterministic) return xxx_messageInfo_IssuedCert.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -521,7 +522,7 @@ var fileDescriptor_80627e709958eb04 = []byte{
func (m *CARoots) Marshal() (dAtA []byte, err error) { func (m *CARoots) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -529,54 +530,66 @@ func (m *CARoots) Marshal() (dAtA []byte, err error) {
} }
func (m *CARoots) MarshalTo(dAtA []byte) (int, error) { func (m *CARoots) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CARoots) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ActiveRootID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintConnect(dAtA, i, uint64(len(m.ActiveRootID)))
i += copy(dAtA[i:], m.ActiveRootID)
} }
if len(m.TrustDomain) > 0 { if m.QueryMeta != nil {
dAtA[i] = 0x12 {
i++ size, err := m.QueryMeta.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintConnect(dAtA, i, uint64(len(m.TrustDomain)))
i += copy(dAtA[i:], m.TrustDomain)
}
if len(m.Roots) > 0 {
for _, msg := range m.Roots {
dAtA[i] = 0x1a
i++
i = encodeVarintConnect(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n i -= size
i = encodeVarintConnect(dAtA, i, uint64(size))
} }
} i--
if m.QueryMeta != nil {
dAtA[i] = 0x22 dAtA[i] = 0x22
i++ }
i = encodeVarintConnect(dAtA, i, uint64(m.QueryMeta.Size())) if len(m.Roots) > 0 {
n1, err := m.QueryMeta.MarshalTo(dAtA[i:]) for iNdEx := len(m.Roots) - 1; iNdEx >= 0; iNdEx-- {
if err != nil { {
return 0, err size, err := m.Roots[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnect(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
} }
i += n1
} }
if m.XXX_unrecognized != nil { if len(m.TrustDomain) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.TrustDomain)
copy(dAtA[i:], m.TrustDomain)
i = encodeVarintConnect(dAtA, i, uint64(len(m.TrustDomain)))
i--
dAtA[i] = 0x12
} }
return i, nil if len(m.ActiveRootID) > 0 {
i -= len(m.ActiveRootID)
copy(dAtA[i:], m.ActiveRootID)
i = encodeVarintConnect(dAtA, i, uint64(len(m.ActiveRootID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *CARoot) Marshal() (dAtA []byte, err error) { func (m *CARoot) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -584,145 +597,161 @@ func (m *CARoot) Marshal() (dAtA []byte, err error) {
} }
func (m *CARoot) MarshalTo(dAtA []byte) (int, error) { func (m *CARoot) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CARoot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintConnect(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
} }
if len(m.Name) > 0 { if m.RaftIndex != nil {
dAtA[i] = 0x12 {
i++ size, err := m.RaftIndex.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintConnect(dAtA, i, uint64(len(m.Name))) if err != nil {
i += copy(dAtA[i:], m.Name) return 0, err
}
if m.SerialNumber != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintConnect(dAtA, i, uint64(m.SerialNumber))
}
if len(m.SigningKeyID) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.SigningKeyID)))
i += copy(dAtA[i:], m.SigningKeyID)
}
if len(m.ExternalTrustDomain) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.ExternalTrustDomain)))
i += copy(dAtA[i:], m.ExternalTrustDomain)
}
if m.NotBefore != nil {
dAtA[i] = 0x32
i++
i = encodeVarintConnect(dAtA, i, uint64(m.NotBefore.Size()))
n2, err := m.NotBefore.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
if m.NotAfter != nil {
dAtA[i] = 0x3a
i++
i = encodeVarintConnect(dAtA, i, uint64(m.NotAfter.Size()))
n3, err := m.NotAfter.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
}
if len(m.RootCert) > 0 {
dAtA[i] = 0x42
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.RootCert)))
i += copy(dAtA[i:], m.RootCert)
}
if len(m.IntermediateCerts) > 0 {
for _, s := range m.IntermediateCerts {
dAtA[i] = 0x4a
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
} }
dAtA[i] = uint8(l) i -= size
i++ i = encodeVarintConnect(dAtA, i, uint64(size))
i += copy(dAtA[i:], s)
} }
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x82
} }
if len(m.SigningCert) > 0 { if m.PrivateKeyBits != 0 {
dAtA[i] = 0x52 i = encodeVarintConnect(dAtA, i, uint64(m.PrivateKeyBits))
i++ i--
i = encodeVarintConnect(dAtA, i, uint64(len(m.SigningCert))) dAtA[i] = 0x78
i += copy(dAtA[i:], m.SigningCert)
} }
if len(m.SigningKey) > 0 { if len(m.PrivateKeyType) > 0 {
dAtA[i] = 0x5a i -= len(m.PrivateKeyType)
i++ copy(dAtA[i:], m.PrivateKeyType)
i = encodeVarintConnect(dAtA, i, uint64(len(m.SigningKey))) i = encodeVarintConnect(dAtA, i, uint64(len(m.PrivateKeyType)))
i += copy(dAtA[i:], m.SigningKey) i--
dAtA[i] = 0x72
}
if m.RotatedOutAt != nil {
{
size, err := m.RotatedOutAt.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnect(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6a
} }
if m.Active { if m.Active {
dAtA[i] = 0x60 i--
i++
if m.Active { if m.Active {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x60
} }
if m.RotatedOutAt != nil { if len(m.SigningKey) > 0 {
dAtA[i] = 0x6a i -= len(m.SigningKey)
i++ copy(dAtA[i:], m.SigningKey)
i = encodeVarintConnect(dAtA, i, uint64(m.RotatedOutAt.Size())) i = encodeVarintConnect(dAtA, i, uint64(len(m.SigningKey)))
n4, err := m.RotatedOutAt.MarshalTo(dAtA[i:]) i--
if err != nil { dAtA[i] = 0x5a
return 0, err }
if len(m.SigningCert) > 0 {
i -= len(m.SigningCert)
copy(dAtA[i:], m.SigningCert)
i = encodeVarintConnect(dAtA, i, uint64(len(m.SigningCert)))
i--
dAtA[i] = 0x52
}
if len(m.IntermediateCerts) > 0 {
for iNdEx := len(m.IntermediateCerts) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.IntermediateCerts[iNdEx])
copy(dAtA[i:], m.IntermediateCerts[iNdEx])
i = encodeVarintConnect(dAtA, i, uint64(len(m.IntermediateCerts[iNdEx])))
i--
dAtA[i] = 0x4a
} }
i += n4
} }
if len(m.PrivateKeyType) > 0 { if len(m.RootCert) > 0 {
dAtA[i] = 0x72 i -= len(m.RootCert)
i++ copy(dAtA[i:], m.RootCert)
i = encodeVarintConnect(dAtA, i, uint64(len(m.PrivateKeyType))) i = encodeVarintConnect(dAtA, i, uint64(len(m.RootCert)))
i += copy(dAtA[i:], m.PrivateKeyType) i--
dAtA[i] = 0x42
} }
if m.PrivateKeyBits != 0 { if m.NotAfter != nil {
dAtA[i] = 0x78 {
i++ size, err := m.NotAfter.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintConnect(dAtA, i, uint64(m.PrivateKeyBits)) if err != nil {
} return 0, err
if m.RaftIndex != nil { }
dAtA[i] = 0x82 i -= size
i++ i = encodeVarintConnect(dAtA, i, uint64(size))
dAtA[i] = 0x1
i++
i = encodeVarintConnect(dAtA, i, uint64(m.RaftIndex.Size()))
n5, err := m.RaftIndex.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
} }
i += n5 i--
dAtA[i] = 0x3a
} }
if m.XXX_unrecognized != nil { if m.NotBefore != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) {
size, err := m.NotBefore.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnect(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
} }
return i, nil if len(m.ExternalTrustDomain) > 0 {
i -= len(m.ExternalTrustDomain)
copy(dAtA[i:], m.ExternalTrustDomain)
i = encodeVarintConnect(dAtA, i, uint64(len(m.ExternalTrustDomain)))
i--
dAtA[i] = 0x2a
}
if len(m.SigningKeyID) > 0 {
i -= len(m.SigningKeyID)
copy(dAtA[i:], m.SigningKeyID)
i = encodeVarintConnect(dAtA, i, uint64(len(m.SigningKeyID)))
i--
dAtA[i] = 0x22
}
if m.SerialNumber != 0 {
i = encodeVarintConnect(dAtA, i, uint64(m.SerialNumber))
i--
dAtA[i] = 0x18
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintConnect(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0x12
}
if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintConnect(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *IssuedCert) Marshal() (dAtA []byte, err error) { func (m *IssuedCert) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -730,106 +759,129 @@ func (m *IssuedCert) Marshal() (dAtA []byte, err error) {
} }
func (m *IssuedCert) MarshalTo(dAtA []byte) (int, error) { func (m *IssuedCert) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *IssuedCert) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.SerialNumber) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintConnect(dAtA, i, uint64(len(m.SerialNumber)))
i += copy(dAtA[i:], m.SerialNumber)
}
if len(m.CertPEM) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.CertPEM)))
i += copy(dAtA[i:], m.CertPEM)
}
if len(m.PrivateKeyPEM) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.PrivateKeyPEM)))
i += copy(dAtA[i:], m.PrivateKeyPEM)
}
if len(m.Service) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.Service)))
i += copy(dAtA[i:], m.Service)
}
if len(m.ServiceURI) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.ServiceURI)))
i += copy(dAtA[i:], m.ServiceURI)
}
if len(m.Agent) > 0 {
dAtA[i] = 0x32
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.Agent)))
i += copy(dAtA[i:], m.Agent)
}
if len(m.AgentURI) > 0 {
dAtA[i] = 0x3a
i++
i = encodeVarintConnect(dAtA, i, uint64(len(m.AgentURI)))
i += copy(dAtA[i:], m.AgentURI)
}
if m.ValidAfter != nil {
dAtA[i] = 0x42
i++
i = encodeVarintConnect(dAtA, i, uint64(m.ValidAfter.Size()))
n6, err := m.ValidAfter.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n6
}
if m.ValidBefore != nil {
dAtA[i] = 0x4a
i++
i = encodeVarintConnect(dAtA, i, uint64(m.ValidBefore.Size()))
n7, err := m.ValidBefore.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n7
}
if m.EnterpriseMeta != nil {
dAtA[i] = 0x52
i++
i = encodeVarintConnect(dAtA, i, uint64(m.EnterpriseMeta.Size()))
n8, err := m.EnterpriseMeta.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n8
} }
if m.RaftIndex != nil { if m.RaftIndex != nil {
dAtA[i] = 0x5a {
i++ size, err := m.RaftIndex.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintConnect(dAtA, i, uint64(m.RaftIndex.Size())) if err != nil {
n9, err := m.RaftIndex.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintConnect(dAtA, i, uint64(size))
} }
i += n9 i--
dAtA[i] = 0x5a
} }
if m.XXX_unrecognized != nil { if m.EnterpriseMeta != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) {
size, err := m.EnterpriseMeta.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnect(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x52
} }
return i, nil if m.ValidBefore != nil {
{
size, err := m.ValidBefore.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnect(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x4a
}
if m.ValidAfter != nil {
{
size, err := m.ValidAfter.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnect(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
}
if len(m.AgentURI) > 0 {
i -= len(m.AgentURI)
copy(dAtA[i:], m.AgentURI)
i = encodeVarintConnect(dAtA, i, uint64(len(m.AgentURI)))
i--
dAtA[i] = 0x3a
}
if len(m.Agent) > 0 {
i -= len(m.Agent)
copy(dAtA[i:], m.Agent)
i = encodeVarintConnect(dAtA, i, uint64(len(m.Agent)))
i--
dAtA[i] = 0x32
}
if len(m.ServiceURI) > 0 {
i -= len(m.ServiceURI)
copy(dAtA[i:], m.ServiceURI)
i = encodeVarintConnect(dAtA, i, uint64(len(m.ServiceURI)))
i--
dAtA[i] = 0x2a
}
if len(m.Service) > 0 {
i -= len(m.Service)
copy(dAtA[i:], m.Service)
i = encodeVarintConnect(dAtA, i, uint64(len(m.Service)))
i--
dAtA[i] = 0x22
}
if len(m.PrivateKeyPEM) > 0 {
i -= len(m.PrivateKeyPEM)
copy(dAtA[i:], m.PrivateKeyPEM)
i = encodeVarintConnect(dAtA, i, uint64(len(m.PrivateKeyPEM)))
i--
dAtA[i] = 0x1a
}
if len(m.CertPEM) > 0 {
i -= len(m.CertPEM)
copy(dAtA[i:], m.CertPEM)
i = encodeVarintConnect(dAtA, i, uint64(len(m.CertPEM)))
i--
dAtA[i] = 0x12
}
if len(m.SerialNumber) > 0 {
i -= len(m.SerialNumber)
copy(dAtA[i:], m.SerialNumber)
i = encodeVarintConnect(dAtA, i, uint64(len(m.SerialNumber)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintConnect(dAtA []byte, offset int, v uint64) int { func encodeVarintConnect(dAtA []byte, offset int, v uint64) int {
offset -= sovConnect(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *CARoots) Size() (n int) { func (m *CARoots) Size() (n int) {
if m == nil { if m == nil {
@ -993,14 +1045,7 @@ func (m *IssuedCert) Size() (n int) {
} }
func sovConnect(x uint64) (n int) { func sovConnect(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozConnect(x uint64) (n int) { func sozConnect(x uint64) (n int) {
return sovConnect(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovConnect(uint64((x << 1) ^ uint64((int64(x) >> 63))))