1
0
mirror of https://github.com/libp2p/go-libp2p-core.git synced 2025-04-28 17:10:14 +08:00

fix: rebuild protos with new gogofaster generator

This commit is contained in:
Yusef Napora 2019-12-20 16:14:10 -05:00
parent 982d6a05fe
commit f24669b805
3 changed files with 126 additions and 166 deletions

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
@ -20,7 +21,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type KeyType int32
@ -87,7 +88,7 @@ func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PublicKey.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
@ -139,7 +140,7 @@ func (m *PrivateKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PrivateKey.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
@ -200,7 +201,7 @@ var fileDescriptor_527278fb02d03321 = []byte{
func (m *PublicKey) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@ -208,26 +209,32 @@ func (m *PublicKey) Marshal() (dAtA []byte, err error) {
}
func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
dAtA[i] = 0x8
i++
i = encodeVarintCrypto(dAtA, i, uint64(m.Type))
if m.Data != nil {
dAtA[i] = 0x12
i++
i -= len(m.Data)
copy(dAtA[i:], m.Data)
i = encodeVarintCrypto(dAtA, i, uint64(len(m.Data)))
i += copy(dAtA[i:], m.Data)
i--
dAtA[i] = 0x12
}
return i, nil
i = encodeVarintCrypto(dAtA, i, uint64(m.Type))
i--
dAtA[i] = 0x8
return len(dAtA) - i, nil
}
func (m *PrivateKey) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@ -235,30 +242,38 @@ func (m *PrivateKey) Marshal() (dAtA []byte, err error) {
}
func (m *PrivateKey) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PrivateKey) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
dAtA[i] = 0x8
i++
i = encodeVarintCrypto(dAtA, i, uint64(m.Type))
if m.Data != nil {
dAtA[i] = 0x12
i++
i -= len(m.Data)
copy(dAtA[i:], m.Data)
i = encodeVarintCrypto(dAtA, i, uint64(len(m.Data)))
i += copy(dAtA[i:], m.Data)
i--
dAtA[i] = 0x12
}
return i, nil
i = encodeVarintCrypto(dAtA, i, uint64(m.Type))
i--
dAtA[i] = 0x8
return len(dAtA) - i, nil
}
func encodeVarintCrypto(dAtA []byte, offset int, v uint64) int {
offset -= sovCrypto(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
return base
}
func (m *PublicKey) Size() (n int) {
if m == nil {
@ -289,14 +304,7 @@ func (m *PrivateKey) Size() (n int) {
}
func sovCrypto(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
return (math_bits.Len64(x|1) + 6) / 7
}
func sozCrypto(x uint64) (n int) {
return sovCrypto(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -534,6 +542,7 @@ func (m *PrivateKey) Unmarshal(dAtA []byte) error {
func skipCrypto(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
@ -565,10 +574,8 @@ func skipCrypto(dAtA []byte) (n int, err error) {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
@ -589,55 +596,30 @@ func skipCrypto(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthCrypto
}
iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthCrypto
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCrypto
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipCrypto(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthCrypto
}
}
return iNdEx, nil
depth++
case 4:
return iNdEx, nil
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupCrypto
}
depth--
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthCrypto
}
if depth == 0 {
return iNdEx, nil
}
}
panic("unreachable")
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow")
ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupCrypto = fmt.Errorf("proto: unexpected end of group")
)

View File

@ -8,6 +8,7 @@ import (
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
@ -19,11 +20,11 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type SignedEnvelope struct {
PublicKey *PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
PayloadType []byte `protobuf:"bytes,2,opt,name=payload_type,json=payloadType,proto3" json:"payload_type,omitempty"`
PublicKey *PublicKey `protobuf:"bytes,1,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
PayloadType []byte `protobuf:"bytes,2,opt,name=payloadType,proto3" json:"payloadType,omitempty"`
Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"`
}
@ -42,7 +43,7 @@ func (m *SignedEnvelope) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_SignedEnvelope.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
@ -96,26 +97,25 @@ func init() {
func init() { proto.RegisterFile("envelope.proto", fileDescriptor_ee266e8c558e9dc5) }
var fileDescriptor_ee266e8c558e9dc5 = []byte{
// 200 bytes of a gzipped FileDescriptorProto
// 189 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4b, 0xcd, 0x2b, 0x4b,
0xcd, 0xc9, 0x2f, 0x48, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4c, 0x2e, 0xaa, 0x2c,
0x28, 0xc9, 0xd7, 0x2b, 0x48, 0x92, 0xe2, 0x81, 0x31, 0x41, 0x12, 0x4a, 0x0b, 0x18, 0xb9, 0xf8,
0x82, 0x33, 0xd3, 0xf3, 0x52, 0x53, 0x5c, 0xa1, 0x3a, 0x84, 0x8c, 0xb9, 0xb8, 0x0a, 0x4a, 0x93,
0x72, 0x32, 0x93, 0xe3, 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x44, 0xf4,
0xe0, 0x06, 0xe8, 0x05, 0x80, 0x25, 0xbd, 0x53, 0x2b, 0x83, 0x38, 0x0b, 0x60, 0x4c, 0x21, 0x45,
0x2e, 0x9e, 0x82, 0xc4, 0xca, 0x9c, 0xfc, 0xc4, 0x94, 0xf8, 0x92, 0xca, 0x82, 0x54, 0x09, 0x26,
0x05, 0x46, 0x0d, 0x9e, 0x20, 0x6e, 0xa8, 0x58, 0x48, 0x65, 0x41, 0xaa, 0x90, 0x04, 0x17, 0x3b,
0x94, 0x2b, 0xc1, 0x0c, 0x96, 0x85, 0x71, 0x85, 0x64, 0xb8, 0x38, 0x8b, 0x33, 0xd3, 0xf3, 0x12,
0x4b, 0x4a, 0x8b, 0x52, 0x25, 0x58, 0xc0, 0x72, 0x08, 0x01, 0x27, 0x89, 0x13, 0x8f, 0xe4, 0x18,
0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5,
0x18, 0x6e, 0x3c, 0x96, 0x63, 0x48, 0x62, 0x03, 0xfb, 0xc1, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff,
0x40, 0xc9, 0x83, 0xba, 0xee, 0x00, 0x00, 0x00,
0x28, 0xc9, 0xd7, 0x2b, 0x48, 0x92, 0xe2, 0x81, 0x31, 0x41, 0x12, 0x4a, 0xf3, 0x18, 0xb9, 0xf8,
0x82, 0x33, 0xd3, 0xf3, 0x52, 0x53, 0x5c, 0xa1, 0x3a, 0x84, 0x8c, 0xb8, 0x38, 0x0b, 0x4a, 0x93,
0x72, 0x32, 0x93, 0xbd, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x44, 0xf4, 0xe0,
0xfa, 0xf5, 0x02, 0x60, 0x72, 0x41, 0x08, 0x65, 0x42, 0x0a, 0x5c, 0xdc, 0x05, 0x89, 0x95, 0x39,
0xf9, 0x89, 0x29, 0x21, 0x95, 0x05, 0xa9, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0xc8, 0x42,
0x42, 0x12, 0x5c, 0xec, 0x50, 0xae, 0x04, 0x33, 0x58, 0x16, 0xc6, 0x15, 0x92, 0xe1, 0xe2, 0x2c,
0xce, 0x4c, 0xcf, 0x4b, 0x2c, 0x29, 0x2d, 0x4a, 0x95, 0x60, 0x01, 0xcb, 0x21, 0x04, 0x9c, 0x24,
0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5,
0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x89, 0x0d, 0xec, 0x03, 0x63, 0x40,
0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0xd3, 0xde, 0xe5, 0xec, 0x00, 0x00, 0x00,
}
func (m *SignedEnvelope) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@ -123,49 +123,61 @@ func (m *SignedEnvelope) Marshal() (dAtA []byte, err error) {
}
func (m *SignedEnvelope) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SignedEnvelope) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.PublicKey != nil {
dAtA[i] = 0xa
i++
i = encodeVarintEnvelope(dAtA, i, uint64(m.PublicKey.Size()))
n1, err := m.PublicKey.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
if len(m.PayloadType) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintEnvelope(dAtA, i, uint64(len(m.PayloadType)))
i += copy(dAtA[i:], m.PayloadType)
if len(m.Signature) > 0 {
i -= len(m.Signature)
copy(dAtA[i:], m.Signature)
i = encodeVarintEnvelope(dAtA, i, uint64(len(m.Signature)))
i--
dAtA[i] = 0x22
}
if len(m.Payload) > 0 {
dAtA[i] = 0x1a
i++
i -= len(m.Payload)
copy(dAtA[i:], m.Payload)
i = encodeVarintEnvelope(dAtA, i, uint64(len(m.Payload)))
i += copy(dAtA[i:], m.Payload)
i--
dAtA[i] = 0x1a
}
if len(m.Signature) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintEnvelope(dAtA, i, uint64(len(m.Signature)))
i += copy(dAtA[i:], m.Signature)
if len(m.PayloadType) > 0 {
i -= len(m.PayloadType)
copy(dAtA[i:], m.PayloadType)
i = encodeVarintEnvelope(dAtA, i, uint64(len(m.PayloadType)))
i--
dAtA[i] = 0x12
}
return i, nil
if m.PublicKey != nil {
{
size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintEnvelope(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintEnvelope(dAtA []byte, offset int, v uint64) int {
offset -= sovEnvelope(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
return base
}
func (m *SignedEnvelope) Size() (n int) {
if m == nil {
@ -193,14 +205,7 @@ func (m *SignedEnvelope) Size() (n int) {
}
func sovEnvelope(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
return (math_bits.Len64(x|1) + 6) / 7
}
func sozEnvelope(x uint64) (n int) {
return sovEnvelope(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -399,6 +404,7 @@ func (m *SignedEnvelope) Unmarshal(dAtA []byte) error {
func skipEnvelope(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
@ -430,10 +436,8 @@ func skipEnvelope(dAtA []byte) (n int, err error) {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
@ -454,55 +458,30 @@ func skipEnvelope(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthEnvelope
}
iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthEnvelope
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEnvelope
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipEnvelope(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthEnvelope
}
}
return iNdEx, nil
depth++
case 4:
return iNdEx, nil
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEnvelope
}
depth--
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthEnvelope
}
if depth == 0 {
return iNdEx, nil
}
}
panic("unreachable")
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthEnvelope = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEnvelope = fmt.Errorf("proto: integer overflow")
ErrInvalidLengthEnvelope = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEnvelope = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEnvelope = fmt.Errorf("proto: unexpected end of group")
)

1
go.mod
View File

@ -4,7 +4,6 @@ require (
github.com/btcsuite/btcd v0.20.1-beta
github.com/coreos/go-semver v0.3.0
github.com/gogo/protobuf v1.3.1
github.com/golang/protobuf v1.3.1
github.com/ipfs/go-cid v0.0.4
github.com/jbenet/goprocess v0.1.3
github.com/libp2p/go-buffer-pool v0.0.1