From d840d920a13dcc5a4536955cc3953048a0cfc07e Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 17 Sep 2022 21:19:19 +0300 Subject: [PATCH] noise: use proto2 for the protobuf --- p2p/security/noise/pb/payload.pb.go | 44 ++++++++++++++--------------- p2p/security/noise/pb/payload.proto | 8 +++--- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/p2p/security/noise/pb/payload.pb.go b/p2p/security/noise/pb/payload.pb.go index ffb29c3c87..7a48d40643 100644 --- a/p2p/security/noise/pb/payload.pb.go +++ b/p2p/security/noise/pb/payload.pb.go @@ -23,9 +23,9 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type NoiseHandshakePayload struct { - IdentityKey []byte `protobuf:"bytes,1,opt,name=identity_key,json=identityKey,proto3" json:"identity_key,omitempty"` - IdentitySig []byte `protobuf:"bytes,2,opt,name=identity_sig,json=identitySig,proto3" json:"identity_sig,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + IdentityKey []byte `protobuf:"bytes,1,opt,name=identity_key,json=identityKey" json:"identity_key"` + IdentitySig []byte `protobuf:"bytes,2,opt,name=identity_sig,json=identitySig" json:"identity_sig"` + Data []byte `protobuf:"bytes,3,opt,name=data" json:"data"` } func (m *NoiseHandshakePayload) Reset() { *m = NoiseHandshakePayload{} } @@ -89,17 +89,17 @@ func init() { func init() { proto.RegisterFile("payload.proto", fileDescriptor_678c914f1bee6d56) } var fileDescriptor_678c914f1bee6d56 = []byte{ - // 152 bytes of a gzipped FileDescriptorProto + // 154 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2d, 0x48, 0xac, 0xcc, - 0xc9, 0x4f, 0x4c, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0x2a, 0xe4, - 0x12,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88, 0x1b, 0x26, 0xe3, 0x9d, 0x5a, 0x89, 0xa2, 0xb0, 0x38, 0x33, 0x5d, 0x82, 0x09, 0x9b, 0xc2, + 0xe0, 0xcc, 0x74, 0x21, 0x09, 0x2e, 0x96, 0x94, 0xc4, 0x92, 0x44, 0x09, 0x66, 0x24, 0x05, 0x60, + 0x11, 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, 0x00, 0x04, 0x00, 0x00, + 0xff, 0xff, 0x70, 0xbd, 0xae, 0x77, 0xb3, 0x00, 0x00, 0x00, } func (m *NoiseHandshakePayload) Marshal() (dAtA []byte, err error) { @@ -122,21 +122,21 @@ func (m *NoiseHandshakePayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Data) > 0 { + if m.Data != nil { i -= len(m.Data) copy(dAtA[i:], m.Data) i = encodeVarintPayload(dAtA, i, uint64(len(m.Data))) i-- dAtA[i] = 0x1a } - if len(m.IdentitySig) > 0 { + if m.IdentitySig != nil { i -= len(m.IdentitySig) copy(dAtA[i:], m.IdentitySig) i = encodeVarintPayload(dAtA, i, uint64(len(m.IdentitySig))) i-- dAtA[i] = 0x12 } - if len(m.IdentityKey) > 0 { + if m.IdentityKey != nil { i -= len(m.IdentityKey) copy(dAtA[i:], m.IdentityKey) i = encodeVarintPayload(dAtA, i, uint64(len(m.IdentityKey))) @@ -163,16 +163,16 @@ func (m *NoiseHandshakePayload) Size() (n int) { } var l int _ = l - l = len(m.IdentityKey) - if l > 0 { + if m.IdentityKey != nil { + l = len(m.IdentityKey) n += 1 + l + sovPayload(uint64(l)) } - l = len(m.IdentitySig) - if l > 0 { + if m.IdentitySig != nil { + l = len(m.IdentitySig) n += 1 + l + sovPayload(uint64(l)) } - l = len(m.Data) - if l > 0 { + if m.Data != nil { + l = len(m.Data) n += 1 + l + sovPayload(uint64(l)) } return n diff --git a/p2p/security/noise/pb/payload.proto b/p2p/security/noise/pb/payload.proto index 05a78c6f39..7a5eed07b3 100644 --- a/p2p/security/noise/pb/payload.proto +++ b/p2p/security/noise/pb/payload.proto @@ -1,8 +1,8 @@ -syntax = "proto3"; +syntax = "proto2"; package pb; message NoiseHandshakePayload { - bytes identity_key = 1; - bytes identity_sig = 2; - bytes data = 3; + optional bytes identity_key = 1; + optional bytes identity_sig = 2; + optional bytes data = 3; }