From c22b7f532a62073c1980f0a0959eb0d9cf6b3837 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 4 Jan 2023 16:05:18 +1300 Subject: [PATCH] use Google's Protobuf library instead of GoGo --- core/crypto/ed25519_test.go | 45 +- core/crypto/key.go | 25 +- core/crypto/pb/Makefile | 11 - core/crypto/pb/crypto.pb.go | 748 ++---- core/peer/pb/Makefile | 11 - core/peer/pb/peer_record.pb.go | 710 ++---- core/peer/peer_serde.go | 2 - core/peer/record.go | 6 +- core/record/envelope.go | 6 +- core/record/envelope_test.go | 8 +- core/record/pb/Makefile | 11 - core/record/pb/envelope.pb.go | 577 ++--- core/record/pb/envelope.proto | 2 +- core/sec/insecure/insecure.go | 14 +- core/sec/insecure/pb/Makefile | 11 - core/sec/insecure/pb/plaintext.pb.go | 459 +--- core/sec/insecure/pb/plaintext.proto | 2 +- go.mod | 6 +- go.sum | 4 +- p2p/host/autonat/pb/Makefile | 6 - p2p/host/autonat/pb/autonat.pb.go | 1450 +++--------- p2p/host/autonat/proto.go | 4 +- p2p/host/peerstore/pstoreds/addr_book.go | 7 +- p2p/host/peerstore/pstoreds/addr_book_gc.go | 9 +- p2p/host/peerstore/pstoreds/pb/Makefile | 12 - p2p/host/peerstore/pstoreds/pb/pstore.pb.go | 1034 ++------- p2p/host/peerstore/pstoreds/peerstore.go | 2 + p2p/protocol/circuitv1/pb/Makefile | 11 - p2p/protocol/circuitv1/pb/circuitv1.pb.go | 1056 +++------ p2p/protocol/circuitv1/proto.go | 3 + p2p/protocol/circuitv2/pb/Makefile | 11 - p2p/protocol/circuitv2/pb/circuit.pb.go | 2047 ++++------------- p2p/protocol/circuitv2/pb/voucher.pb.go | 526 +---- p2p/protocol/circuitv2/proto.go | 4 + p2p/protocol/circuitv2/proto/voucher.go | 16 +- p2p/protocol/circuitv2/util/io.go | 2 +- p2p/protocol/holepunch/holepuncher.go | 4 +- p2p/protocol/holepunch/pb/Makefile | 11 - p2p/protocol/holepunch/pb/holepunch.pb.go | 510 ++-- p2p/protocol/identify/id.go | 6 +- p2p/protocol/identify/pb/Makefile | 11 - p2p/protocol/identify/pb/identify.pb.go | 744 ++---- .../internal/circuitv1-deprecated/pb/Makefile | 11 - .../circuitv1-deprecated/pb/relay.pb.go | 1055 +++------ .../internal/circuitv1-deprecated/util.go | 9 +- p2p/security/noise/handshake.go | 4 +- p2p/security/noise/pb/Makefile | 11 - p2p/security/noise/pb/payload.pb.go | 781 ++----- 48 files changed, 3076 insertions(+), 8939 deletions(-) delete mode 100644 core/crypto/pb/Makefile delete mode 100644 core/peer/pb/Makefile delete mode 100644 core/record/pb/Makefile delete mode 100644 core/sec/insecure/pb/Makefile delete mode 100644 p2p/host/autonat/pb/Makefile delete mode 100644 p2p/host/peerstore/pstoreds/pb/Makefile delete mode 100644 p2p/protocol/circuitv1/pb/Makefile create mode 100644 p2p/protocol/circuitv1/proto.go delete mode 100644 p2p/protocol/circuitv2/pb/Makefile create mode 100644 p2p/protocol/circuitv2/proto.go delete mode 100644 p2p/protocol/holepunch/pb/Makefile delete mode 100644 p2p/protocol/identify/pb/Makefile delete mode 100644 p2p/protocol/internal/circuitv1-deprecated/pb/Makefile delete mode 100644 p2p/security/noise/pb/Makefile diff --git a/core/crypto/ed25519_test.go b/core/crypto/ed25519_test.go index 78a2fa8839..dd24b42234 100644 --- a/core/crypto/ed25519_test.go +++ b/core/crypto/ed25519_test.go @@ -5,7 +5,9 @@ import ( "crypto/rand" "testing" - pb "github.com/libp2p/go-libp2p/core/crypto/pb" + "github.com/libp2p/go-libp2p/core/crypto/pb" + + "google.golang.org/protobuf/proto" ) func TestBasicSignAndVerify(t *testing.T) { @@ -79,15 +81,15 @@ func TestMarshalLoop(t *testing.T) { // Ed25519 private keys used to contain the public key twice. // For backwards-compatibility, we need to continue supporting // that scenario. - pbmes := new(pb.PrivateKey) - pbmes.Type = priv.Type() data, err := priv.Raw() if err != nil { t.Fatal(err) } - - pbmes.Data = append(data, data[len(data)-ed25519.PublicKeySize:]...) - return pbmes.Marshal() + data = append(data, data[len(data)-ed25519.PublicKeySize:]...) + return proto.Marshal(&pb.PrivateKey{ + Type: priv.Type().Enum(), + Data: data, + }) }, } { t.Run(name, func(t *testing.T) { @@ -150,18 +152,14 @@ func TestMarshalLoop(t *testing.T) { func TestUnmarshalErrors(t *testing.T) { t.Run("PublicKey", func(t *testing.T) { t.Run("Invalid data length", func(t *testing.T) { - pbmes := &pb.PublicKey{ - Type: pb.KeyType_Ed25519, + data, err := proto.Marshal(&pb.PublicKey{ + Type: pb.KeyType_Ed25519.Enum(), Data: []byte{42}, - } - - data, err := pbmes.Marshal() + }) if err != nil { t.Fatal(err) } - - _, err = UnmarshalPublicKey(data) - if err == nil { + if _, err := UnmarshalPublicKey(data); err == nil { t.Fatal("expected an error") } }) @@ -174,16 +172,17 @@ func TestUnmarshalErrors(t *testing.T) { t.Fatal(err) } - pbmes := new(pb.PrivateKey) - pbmes.Type = priv.Type() data, err := priv.Raw() if err != nil { t.Fatal(err) } - // Append the private key instead of the public key. - pbmes.Data = append(data, data[:ed25519.PublicKeySize]...) - b, err := pbmes.Marshal() + data = append(data, data[:ed25519.PublicKeySize]...) + + b, err := proto.Marshal(&pb.PrivateKey{ + Type: priv.Type().Enum(), + Data: data, + }) if err != nil { t.Fatal(err) } @@ -198,12 +197,10 @@ func TestUnmarshalErrors(t *testing.T) { }) t.Run("Invalid data length", func(t *testing.T) { - pbmes := &pb.PrivateKey{ - Type: pb.KeyType_Ed25519, + data, err := proto.Marshal(&pb.PrivateKey{ + Type: pb.KeyType_Ed25519.Enum(), Data: []byte{42}, - } - - data, err := pbmes.Marshal() + }) if err != nil { t.Fatal(err) } diff --git a/core/crypto/key.go b/core/crypto/key.go index 3d7b39a229..9133141c8d 100644 --- a/core/crypto/key.go +++ b/core/crypto/key.go @@ -12,11 +12,13 @@ import ( "fmt" "io" - pb "github.com/libp2p/go-libp2p/core/crypto/pb" + "github.com/libp2p/go-libp2p/core/crypto/pb" - "github.com/gogo/protobuf/proto" + "google.golang.org/protobuf/proto" ) +//go:generate protoc --go_out=. --go_opt=Mpb/crypto.proto=./pb pb/crypto.proto + const ( // RSA is an enum for the supported RSA key type RSA = iota @@ -194,7 +196,7 @@ func PublicKeyFromProto(pmes *pb.PublicKey) (PubKey, error) { switch tpk := pk.(type) { case *RsaPublicKey: - tpk.cached, _ = pmes.Marshal() + tpk.cached, _ = proto.Marshal(pmes) } return pk, nil @@ -214,14 +216,14 @@ func MarshalPublicKey(k PubKey) ([]byte, error) { // PublicKeyToProto converts a public key object into an unserialized // protobuf PublicKey message. func PublicKeyToProto(k PubKey) (*pb.PublicKey, error) { - pbmes := new(pb.PublicKey) - pbmes.Type = k.Type() data, err := k.Raw() if err != nil { return nil, err } - pbmes.Data = data - return pbmes, nil + return &pb.PublicKey{ + Type: k.Type().Enum(), + Data: data, + }, nil } // UnmarshalPrivateKey converts a protobuf serialized private key into its @@ -243,15 +245,14 @@ func UnmarshalPrivateKey(data []byte) (PrivKey, error) { // MarshalPrivateKey converts a key object into its protobuf serialized form. func MarshalPrivateKey(k PrivKey) ([]byte, error) { - pbmes := new(pb.PrivateKey) - pbmes.Type = k.Type() data, err := k.Raw() if err != nil { return nil, err } - - pbmes.Data = data - return proto.Marshal(pbmes) + return proto.Marshal(&pb.PrivateKey{ + Type: k.Type().Enum(), + Data: data, + }) } // ConfigDecodeKey decodes from b64 (for config file) to a byte array that can be unmarshalled. diff --git a/core/crypto/pb/Makefile b/core/crypto/pb/Makefile deleted file mode 100644 index 8af2dd8177..0000000000 --- a/core/crypto/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(PWD)/../..:. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/core/crypto/pb/crypto.pb.go b/core/crypto/pb/crypto.pb.go index 072fad9c93..9c8942e0d8 100644 --- a/core/crypto/pb/crypto.pb.go +++ b/core/crypto/pb/crypto.pb.go @@ -1,27 +1,24 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: crypto.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/crypto.proto -package crypto_pb +package pb import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type KeyType int32 @@ -32,19 +29,21 @@ const ( KeyType_ECDSA KeyType = 3 ) -var KeyType_name = map[int32]string{ - 0: "RSA", - 1: "Ed25519", - 2: "Secp256k1", - 3: "ECDSA", -} - -var KeyType_value = map[string]int32{ - "RSA": 0, - "Ed25519": 1, - "Secp256k1": 2, - "ECDSA": 3, -} +// Enum value maps for KeyType. +var ( + KeyType_name = map[int32]string{ + 0: "RSA", + 1: "Ed25519", + 2: "Secp256k1", + 3: "ECDSA", + } + KeyType_value = map[string]int32{ + "RSA": 0, + "Ed25519": 1, + "Secp256k1": 2, + "ECDSA": 3, + } +) func (x KeyType) Enum() *KeyType { p := new(KeyType) @@ -53,573 +52,246 @@ func (x KeyType) Enum() *KeyType { } func (x KeyType) String() string { - return proto.EnumName(KeyType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (KeyType) Descriptor() protoreflect.EnumDescriptor { + return file_pb_crypto_proto_enumTypes[0].Descriptor() +} + +func (KeyType) Type() protoreflect.EnumType { + return &file_pb_crypto_proto_enumTypes[0] +} + +func (x KeyType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } -func (x *KeyType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(KeyType_value, data, "KeyType") +// Deprecated: Do not use. +func (x *KeyType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = KeyType(value) + *x = KeyType(num) return nil } +// Deprecated: Use KeyType.Descriptor instead. func (KeyType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_527278fb02d03321, []int{0} + return file_pb_crypto_proto_rawDescGZIP(), []int{0} } type PublicKey struct { - Type KeyType `protobuf:"varint,1,req,name=Type,enum=crypto.pb.KeyType" json:"Type"` - Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *PublicKey) Reset() { *m = PublicKey{} } -func (m *PublicKey) String() string { return proto.CompactTextString(m) } -func (*PublicKey) ProtoMessage() {} -func (*PublicKey) Descriptor() ([]byte, []int) { - return fileDescriptor_527278fb02d03321, []int{0} -} -func (m *PublicKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PublicKey.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PublicKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PublicKey.Merge(m, src) -} -func (m *PublicKey) XXX_Size() int { - return m.Size() -} -func (m *PublicKey) XXX_DiscardUnknown() { - xxx_messageInfo_PublicKey.DiscardUnknown(m) + Type *KeyType `protobuf:"varint,1,req,name=Type,enum=crypto.pb.KeyType" json:"Type,omitempty"` + Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data,omitempty"` } -var xxx_messageInfo_PublicKey proto.InternalMessageInfo - -func (m *PublicKey) GetType() KeyType { - if m != nil { - return m.Type +func (x *PublicKey) Reset() { + *x = PublicKey{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_crypto_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return KeyType_RSA } -func (m *PublicKey) GetData() []byte { - if m != nil { - return m.Data - } - return nil +func (x *PublicKey) String() string { + return protoimpl.X.MessageStringOf(x) } -type PrivateKey struct { - Type KeyType `protobuf:"varint,1,req,name=Type,enum=crypto.pb.KeyType" json:"Type"` - Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data"` -} +func (*PublicKey) ProtoMessage() {} -func (m *PrivateKey) Reset() { *m = PrivateKey{} } -func (m *PrivateKey) String() string { return proto.CompactTextString(m) } -func (*PrivateKey) ProtoMessage() {} -func (*PrivateKey) Descriptor() ([]byte, []int) { - return fileDescriptor_527278fb02d03321, []int{1} -} -func (m *PrivateKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PrivateKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PrivateKey.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *PublicKey) ProtoReflect() protoreflect.Message { + mi := &file_pb_crypto_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *PrivateKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrivateKey.Merge(m, src) -} -func (m *PrivateKey) XXX_Size() int { - return m.Size() -} -func (m *PrivateKey) XXX_DiscardUnknown() { - xxx_messageInfo_PrivateKey.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_PrivateKey proto.InternalMessageInfo +// Deprecated: Use PublicKey.ProtoReflect.Descriptor instead. +func (*PublicKey) Descriptor() ([]byte, []int) { + return file_pb_crypto_proto_rawDescGZIP(), []int{0} +} -func (m *PrivateKey) GetType() KeyType { - if m != nil { - return m.Type +func (x *PublicKey) GetType() KeyType { + if x != nil && x.Type != nil { + return *x.Type } return KeyType_RSA } -func (m *PrivateKey) GetData() []byte { - if m != nil { - return m.Data +func (x *PublicKey) GetData() []byte { + if x != nil { + return x.Data } return nil } -func init() { - proto.RegisterEnum("crypto.pb.KeyType", KeyType_name, KeyType_value) - proto.RegisterType((*PublicKey)(nil), "crypto.pb.PublicKey") - proto.RegisterType((*PrivateKey)(nil), "crypto.pb.PrivateKey") -} +type PrivateKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func init() { proto.RegisterFile("crypto.proto", fileDescriptor_527278fb02d03321) } - -var fileDescriptor_527278fb02d03321 = []byte{ - // 203 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x2e, 0xaa, 0x2c, - 0x28, 0xc9, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0xf1, 0x92, 0x94, 0x82, 0xb9, - 0x38, 0x03, 0x4a, 0x93, 0x72, 0x32, 0x93, 0xbd, 0x53, 0x2b, 0x85, 0x74, 0xb8, 0x58, 0x42, 0x2a, - 0x0b, 0x52, 0x25, 0x18, 0x15, 0x98, 0x34, 0xf8, 0x8c, 0x84, 0xf4, 0xe0, 0xca, 0xf4, 0xbc, 0x53, - 0x2b, 0x41, 0x32, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x81, 0x55, 0x09, 0x49, 0x70, 0xb1, - 0xb8, 0x24, 0x96, 0x24, 0x4a, 0x30, 0x29, 0x30, 0x69, 0xf0, 0xc0, 0x64, 0x40, 0x22, 0x4a, 0x21, - 0x5c, 0x5c, 0x01, 0x45, 0x99, 0x65, 0x89, 0x25, 0xa9, 0x54, 0x34, 0x55, 0xcb, 0x92, 0x8b, 0x1d, - 0xaa, 0x41, 0x88, 0x9d, 0x8b, 0x39, 0x28, 0xd8, 0x51, 0x80, 0x41, 0x88, 0x9b, 0x8b, 0xdd, 0x35, - 0xc5, 0xc8, 0xd4, 0xd4, 0xd0, 0x52, 0x80, 0x51, 0x88, 0x97, 0x8b, 0x33, 0x38, 0x35, 0xb9, 0xc0, - 0xc8, 0xd4, 0x2c, 0xdb, 0x50, 0x80, 0x49, 0x88, 0x93, 0x8b, 0xd5, 0xd5, 0xd9, 0x25, 0xd8, 0x51, - 0x80, 0xd9, 0x49, 0xe2, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, - 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0x00, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x13, 0xbe, 0xd4, 0xff, 0x19, 0x01, 0x00, 0x00, + Type *KeyType `protobuf:"varint,1,req,name=Type,enum=crypto.pb.KeyType" json:"Type,omitempty"` + Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data,omitempty"` } -func (m *PublicKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *PrivateKey) Reset() { + *x = PrivateKey{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_crypto_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return dAtA[:n], nil } -func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *PrivateKey) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Data != nil { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintCrypto(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x12 - } - i = encodeVarintCrypto(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} +func (*PrivateKey) ProtoMessage() {} -func (m *PrivateKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *PrivateKey) ProtoReflect() protoreflect.Message { + mi := &file_pb_crypto_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return dAtA[:n], nil -} - -func (m *PrivateKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return mi.MessageOf(x) } -func (m *PrivateKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Data != nil { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintCrypto(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x12 - } - i = encodeVarintCrypto(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil +// Deprecated: Use PrivateKey.ProtoReflect.Descriptor instead. +func (*PrivateKey) Descriptor() ([]byte, []int) { + return file_pb_crypto_proto_rawDescGZIP(), []int{1} } -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 base -} -func (m *PublicKey) Size() (n int) { - if m == nil { - return 0 +func (x *PrivateKey) GetType() KeyType { + if x != nil && x.Type != nil { + return *x.Type } - var l int - _ = l - n += 1 + sovCrypto(uint64(m.Type)) - if m.Data != nil { - l = len(m.Data) - n += 1 + l + sovCrypto(uint64(l)) - } - return n + return KeyType_RSA } -func (m *PrivateKey) Size() (n int) { - if m == nil { - return 0 +func (x *PrivateKey) GetData() []byte { + if x != nil { + return x.Data } - var l int - _ = l - n += 1 + sovCrypto(uint64(m.Type)) - if m.Data != nil { - l = len(m.Data) - n += 1 + l + sovCrypto(uint64(l)) - } - return n + return nil } -func sovCrypto(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +var File_pb_crypto_proto protoreflect.FileDescriptor + +var file_pb_crypto_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x70, 0x62, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x09, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x70, 0x62, 0x22, 0x47, 0x0a, 0x09, + 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, + 0x2e, 0x70, 0x62, 0x2e, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0c, 0x52, + 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x48, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, + 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x70, 0x62, 0x2e, 0x4b, 0x65, + 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, + 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x2a, + 0x39, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x53, + 0x41, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x10, 0x01, + 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, 0x31, 0x10, 0x02, 0x12, + 0x09, 0x0a, 0x05, 0x45, 0x43, 0x44, 0x53, 0x41, 0x10, 0x03, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x62, 0x70, 0x32, 0x70, 0x2f, + 0x67, 0x6f, 0x2d, 0x6c, 0x69, 0x62, 0x70, 0x32, 0x70, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x70, 0x62, } -func sozCrypto(x uint64) (n int) { - return sovCrypto(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PublicKey) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PublicKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PublicKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= KeyType(b&0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCrypto - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCrypto - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - default: - iNdEx = preIndex - skippy, err := skipCrypto(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Type") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Data") - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrivateKey) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PrivateKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrivateKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= KeyType(b&0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCrypto - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCrypto - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - default: - iNdEx = preIndex - skippy, err := skipCrypto(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Type") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Data") - } +var ( + file_pb_crypto_proto_rawDescOnce sync.Once + file_pb_crypto_proto_rawDescData = file_pb_crypto_proto_rawDesc +) - if iNdEx > l { - return io.ErrUnexpectedEOF +func file_pb_crypto_proto_rawDescGZIP() []byte { + file_pb_crypto_proto_rawDescOnce.Do(func() { + file_pb_crypto_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_crypto_proto_rawDescData) + }) + return file_pb_crypto_proto_rawDescData +} + +var file_pb_crypto_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_pb_crypto_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_pb_crypto_proto_goTypes = []interface{}{ + (KeyType)(0), // 0: crypto.pb.KeyType + (*PublicKey)(nil), // 1: crypto.pb.PublicKey + (*PrivateKey)(nil), // 2: crypto.pb.PrivateKey +} +var file_pb_crypto_proto_depIdxs = []int32{ + 0, // 0: crypto.pb.PublicKey.Type:type_name -> crypto.pb.KeyType + 0, // 1: crypto.pb.PrivateKey.Type:type_name -> crypto.pb.KeyType + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_pb_crypto_proto_init() } +func file_pb_crypto_proto_init() { + if File_pb_crypto_proto != nil { + return } - return nil -} -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 { - if shift >= 64 { - return 0, ErrIntOverflowCrypto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + if !protoimpl.UnsafeEnabled { + file_pb_crypto_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublicKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCrypto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCrypto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } + file_pb_crypto_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrivateKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - if length < 0 { - return 0, ErrInvalidLengthCrypto - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCrypto - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCrypto - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_crypto_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_crypto_proto_goTypes, + DependencyIndexes: file_pb_crypto_proto_depIdxs, + EnumInfos: file_pb_crypto_proto_enumTypes, + MessageInfos: file_pb_crypto_proto_msgTypes, + }.Build() + File_pb_crypto_proto = out.File + file_pb_crypto_proto_rawDesc = nil + file_pb_crypto_proto_goTypes = nil + file_pb_crypto_proto_depIdxs = nil } - -var ( - ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCrypto = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core/peer/pb/Makefile b/core/peer/pb/Makefile deleted file mode 100644 index 7cf8222f89..0000000000 --- a/core/peer/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(PWD):$(PWD)/../.. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/core/peer/pb/peer_record.pb.go b/core/peer/pb/peer_record.pb.go index 36040c3c2c..21cd450d4c 100644 --- a/core/peer/pb/peer_record.pb.go +++ b/core/peer/pb/peer_record.pb.go @@ -1,27 +1,24 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: peer_record.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/peer_record.proto -package peer_pb +package pb import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - - proto "github.com/gogo/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) // PeerRecord messages contain information that is useful to share with other peers. // Currently, a PeerRecord contains the public listen addresses for a peer, but this @@ -32,6 +29,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // See https://github.com/libp2p/go-libp2p/core/record/pb/envelope.proto for // the SignedEnvelope definition. type PeerRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // peer_id contains a libp2p peer id in its binary representation. PeerId []byte `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` // seq contains a monotonically-increasing sequence counter to order PeerRecords in time. @@ -40,56 +41,55 @@ type PeerRecord struct { Addresses []*PeerRecord_AddressInfo `protobuf:"bytes,3,rep,name=addresses,proto3" json:"addresses,omitempty"` } -func (m *PeerRecord) Reset() { *m = PeerRecord{} } -func (m *PeerRecord) String() string { return proto.CompactTextString(m) } -func (*PeerRecord) ProtoMessage() {} -func (*PeerRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_dc0d8059ab0ad14d, []int{0} +func (x *PeerRecord) Reset() { + *x = PeerRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_peer_record_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PeerRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *PeerRecord) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PeerRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PeerRecord.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*PeerRecord) ProtoMessage() {} + +func (x *PeerRecord) ProtoReflect() protoreflect.Message { + mi := &file_pb_peer_record_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *PeerRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_PeerRecord.Merge(m, src) -} -func (m *PeerRecord) XXX_Size() int { - return m.Size() -} -func (m *PeerRecord) XXX_DiscardUnknown() { - xxx_messageInfo_PeerRecord.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_PeerRecord proto.InternalMessageInfo +// Deprecated: Use PeerRecord.ProtoReflect.Descriptor instead. +func (*PeerRecord) Descriptor() ([]byte, []int) { + return file_pb_peer_record_proto_rawDescGZIP(), []int{0} +} -func (m *PeerRecord) GetPeerId() []byte { - if m != nil { - return m.PeerId +func (x *PeerRecord) GetPeerId() []byte { + if x != nil { + return x.PeerId } return nil } -func (m *PeerRecord) GetSeq() uint64 { - if m != nil { - return m.Seq +func (x *PeerRecord) GetSeq() uint64 { + if x != nil { + return x.Seq } return 0 } -func (m *PeerRecord) GetAddresses() []*PeerRecord_AddressInfo { - if m != nil { - return m.Addresses +func (x *PeerRecord) GetAddresses() []*PeerRecord_AddressInfo { + if x != nil { + return x.Addresses } return nil } @@ -97,511 +97,143 @@ func (m *PeerRecord) GetAddresses() []*PeerRecord_AddressInfo { // AddressInfo is a wrapper around a binary multiaddr. It is defined as a // separate message to allow us to add per-address metadata in the future. type PeerRecord_AddressInfo struct { - Multiaddr []byte `protobuf:"bytes,1,opt,name=multiaddr,proto3" json:"multiaddr,omitempty"` -} - -func (m *PeerRecord_AddressInfo) Reset() { *m = PeerRecord_AddressInfo{} } -func (m *PeerRecord_AddressInfo) String() string { return proto.CompactTextString(m) } -func (*PeerRecord_AddressInfo) ProtoMessage() {} -func (*PeerRecord_AddressInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_dc0d8059ab0ad14d, []int{0, 0} -} -func (m *PeerRecord_AddressInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PeerRecord_AddressInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PeerRecord_AddressInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PeerRecord_AddressInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_PeerRecord_AddressInfo.Merge(m, src) -} -func (m *PeerRecord_AddressInfo) XXX_Size() int { - return m.Size() -} -func (m *PeerRecord_AddressInfo) XXX_DiscardUnknown() { - xxx_messageInfo_PeerRecord_AddressInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_PeerRecord_AddressInfo proto.InternalMessageInfo - -func (m *PeerRecord_AddressInfo) GetMultiaddr() []byte { - if m != nil { - return m.Multiaddr - } - return nil -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func init() { - proto.RegisterType((*PeerRecord)(nil), "peer.pb.PeerRecord") - proto.RegisterType((*PeerRecord_AddressInfo)(nil), "peer.pb.PeerRecord.AddressInfo") -} - -func init() { proto.RegisterFile("peer_record.proto", fileDescriptor_dc0d8059ab0ad14d) } - -var fileDescriptor_dc0d8059ab0ad14d = []byte{ - // 189 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x48, 0x4d, 0x2d, - 0x8a, 0x2f, 0x4a, 0x4d, 0xce, 0x2f, 0x4a, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x07, - 0x09, 0xe9, 0x15, 0x24, 0x29, 0x2d, 0x66, 0xe4, 0xe2, 0x0a, 0x48, 0x4d, 0x2d, 0x0a, 0x02, 0xcb, - 0x0a, 0x89, 0x73, 0x81, 0x65, 0xe2, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0xd8, - 0x40, 0x5c, 0xcf, 0x14, 0x21, 0x01, 0x2e, 0xe6, 0xe2, 0xd4, 0x42, 0x09, 0x26, 0x05, 0x46, 0x0d, - 0x96, 0x20, 0x10, 0x53, 0xc8, 0x96, 0x8b, 0x33, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x38, 0xb5, - 0x58, 0x82, 0x59, 0x81, 0x59, 0x83, 0xdb, 0x48, 0x5e, 0x0f, 0x6a, 0xac, 0x1e, 0xc2, 0x48, 0x3d, - 0x47, 0x88, 0x22, 0xcf, 0xbc, 0xb4, 0xfc, 0x20, 0x84, 0x0e, 0x29, 0x6d, 0x2e, 0x6e, 0x24, 0x19, - 0x21, 0x19, 0x2e, 0xce, 0xdc, 0xd2, 0x9c, 0x92, 0x4c, 0x90, 0x02, 0xa8, 0xd5, 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, 0xc7, 0x18, - 0x10, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x99, 0x56, 0x19, 0xe4, 0x00, 0x00, 0x00, -} - -func (m *PeerRecord) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PeerRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PeerRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Addresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPeerRecord(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Seq != 0 { - i = encodeVarintPeerRecord(dAtA, i, uint64(m.Seq)) - i-- - dAtA[i] = 0x10 - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = encodeVarintPeerRecord(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + Multiaddr []byte `protobuf:"bytes,1,opt,name=multiaddr,proto3" json:"multiaddr,omitempty"` } -func (m *PeerRecord_AddressInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *PeerRecord_AddressInfo) Reset() { + *x = PeerRecord_AddressInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_peer_record_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return dAtA[:n], nil } -func (m *PeerRecord_AddressInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *PeerRecord_AddressInfo) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PeerRecord_AddressInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Multiaddr) > 0 { - i -= len(m.Multiaddr) - copy(dAtA[i:], m.Multiaddr) - i = encodeVarintPeerRecord(dAtA, i, uint64(len(m.Multiaddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} +func (*PeerRecord_AddressInfo) ProtoMessage() {} -func encodeVarintPeerRecord(dAtA []byte, offset int, v uint64) int { - offset -= sovPeerRecord(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PeerRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + sovPeerRecord(uint64(l)) - } - if m.Seq != 0 { - n += 1 + sovPeerRecord(uint64(m.Seq)) - } - if len(m.Addresses) > 0 { - for _, e := range m.Addresses { - l = e.Size() - n += 1 + l + sovPeerRecord(uint64(l)) +func (x *PeerRecord_AddressInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_peer_record_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - return n + return mi.MessageOf(x) } -func (m *PeerRecord_AddressInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Multiaddr) - if l > 0 { - n += 1 + l + sovPeerRecord(uint64(l)) - } - return n -} - -func sovPeerRecord(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozPeerRecord(x uint64) (n int) { - return sovPeerRecord(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +// Deprecated: Use PeerRecord_AddressInfo.ProtoReflect.Descriptor instead. +func (*PeerRecord_AddressInfo) Descriptor() ([]byte, []int) { + return file_pb_peer_record_proto_rawDescGZIP(), []int{0, 0} } -func (m *PeerRecord) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PeerRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PeerRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPeerRecord - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPeerRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = append(m.PeerId[:0], dAtA[iNdEx:postIndex]...) - if m.PeerId == nil { - m.PeerId = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) - } - m.Seq = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Seq |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPeerRecord - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPeerRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, &PeerRecord_AddressInfo{}) - if err := m.Addresses[len(m.Addresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPeerRecord(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPeerRecord - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPeerRecord - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *PeerRecord_AddressInfo) GetMultiaddr() []byte { + if x != nil { + return x.Multiaddr } return nil } -func (m *PeerRecord_AddressInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AddressInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AddressInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Multiaddr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPeerRecord - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPeerRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Multiaddr = append(m.Multiaddr[:0], dAtA[iNdEx:postIndex]...) - if m.Multiaddr == nil { - m.Multiaddr = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPeerRecord(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPeerRecord - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPeerRecord - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipPeerRecord(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 { - if shift >= 64 { - return 0, ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPeerRecord - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthPeerRecord - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPeerRecord - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthPeerRecord - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var File_pb_peer_record_proto protoreflect.FileDescriptor + +var file_pb_peer_record_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x70, 0x62, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x70, 0x62, 0x22, + 0xa3, 0x01, 0x0a, 0x0a, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x17, + 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x3d, 0x0a, 0x09, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, + 0x65, 0x65, 0x72, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x1a, 0x2b, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x6d, 0x75, 0x6c, 0x74, + 0x69, 0x61, 0x64, 0x64, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthPeerRecord = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPeerRecord = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPeerRecord = fmt.Errorf("proto: unexpected end of group") + file_pb_peer_record_proto_rawDescOnce sync.Once + file_pb_peer_record_proto_rawDescData = file_pb_peer_record_proto_rawDesc ) + +func file_pb_peer_record_proto_rawDescGZIP() []byte { + file_pb_peer_record_proto_rawDescOnce.Do(func() { + file_pb_peer_record_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_peer_record_proto_rawDescData) + }) + return file_pb_peer_record_proto_rawDescData +} + +var file_pb_peer_record_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_pb_peer_record_proto_goTypes = []interface{}{ + (*PeerRecord)(nil), // 0: peer.pb.PeerRecord + (*PeerRecord_AddressInfo)(nil), // 1: peer.pb.PeerRecord.AddressInfo +} +var file_pb_peer_record_proto_depIdxs = []int32{ + 1, // 0: peer.pb.PeerRecord.addresses:type_name -> peer.pb.PeerRecord.AddressInfo + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pb_peer_record_proto_init() } +func file_pb_peer_record_proto_init() { + if File_pb_peer_record_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_peer_record_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_peer_record_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerRecord_AddressInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_peer_record_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_peer_record_proto_goTypes, + DependencyIndexes: file_pb_peer_record_proto_depIdxs, + MessageInfos: file_pb_peer_record_proto_msgTypes, + }.Build() + File_pb_peer_record_proto = out.File + file_pb_peer_record_proto_rawDesc = nil + file_pb_peer_record_proto_goTypes = nil + file_pb_peer_record_proto_depIdxs = nil +} diff --git a/core/peer/peer_serde.go b/core/peer/peer_serde.go index e3ac3f2c98..5fd1cd50c9 100644 --- a/core/peer/peer_serde.go +++ b/core/peer/peer_serde.go @@ -40,8 +40,6 @@ func (id *ID) UnmarshalBinary(data []byte) error { return id.Unmarshal(data) } -// Size implements Gogo's proto.Sizer, but we omit the compile-time assertion to avoid introducing a hard -// dependency on gogo. func (id ID) Size() int { return len([]byte(id)) } diff --git a/core/peer/record.go b/core/peer/record.go index b502c8dd14..0fc7e552db 100644 --- a/core/peer/record.go +++ b/core/peer/record.go @@ -6,14 +6,16 @@ import ( "time" "github.com/libp2p/go-libp2p/core/internal/catch" - pb "github.com/libp2p/go-libp2p/core/peer/pb" + "github.com/libp2p/go-libp2p/core/peer/pb" "github.com/libp2p/go-libp2p/core/record" ma "github.com/multiformats/go-multiaddr" - "github.com/gogo/protobuf/proto" + "google.golang.org/protobuf/proto" ) +//go:generate protoc --proto_path=$PWD:$PWD/../.. --go_out=. --go_opt=Mpb/peer_record.proto=./pb pb/peer_record.proto + var _ record.Record = (*PeerRecord)(nil) func init() { diff --git a/core/record/envelope.go b/core/record/envelope.go index 38811994be..6643c9a655 100644 --- a/core/record/envelope.go +++ b/core/record/envelope.go @@ -8,14 +8,16 @@ import ( "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/internal/catch" - pb "github.com/libp2p/go-libp2p/core/record/pb" + "github.com/libp2p/go-libp2p/core/record/pb" pool "github.com/libp2p/go-buffer-pool" - "github.com/gogo/protobuf/proto" "github.com/multiformats/go-varint" + "google.golang.org/protobuf/proto" ) +//go:generate protoc --proto_path=$PWD:$PWD/../.. --go_out=. --go_opt=Mpb/envelope.proto=./pb pb/envelope.proto + // Envelope contains an arbitrary []byte payload, signed by a libp2p peer. // // Envelopes are signed in the context of a particular "domain", which is a diff --git a/core/record/envelope_test.go b/core/record/envelope_test.go index 45ac0e6687..54ee523879 100644 --- a/core/record/envelope_test.go +++ b/core/record/envelope_test.go @@ -5,12 +5,12 @@ import ( "errors" "testing" - crypto "github.com/libp2p/go-libp2p/core/crypto" + "github.com/libp2p/go-libp2p/core/crypto" . "github.com/libp2p/go-libp2p/core/record" - pb "github.com/libp2p/go-libp2p/core/record/pb" + "github.com/libp2p/go-libp2p/core/record/pb" "github.com/libp2p/go-libp2p/core/test" - "github.com/gogo/protobuf/proto" + "google.golang.org/protobuf/proto" ) type simpleRecord struct { @@ -307,7 +307,7 @@ func alterMessageAndMarshal(t *testing.T, envelope *Envelope, alterMsg func(*pb. test.AssertNilError(t, err) alterMsg(&msg) - serialized, err = msg.Marshal() + serialized, err = proto.Marshal(&msg) test.AssertNilError(t, err) return serialized diff --git a/core/record/pb/Makefile b/core/record/pb/Makefile deleted file mode 100644 index 7cf8222f89..0000000000 --- a/core/record/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(PWD):$(PWD)/../.. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/core/record/pb/envelope.pb.go b/core/record/pb/envelope.pb.go index a999021753..6e11121504 100644 --- a/core/record/pb/envelope.pb.go +++ b/core/record/pb/envelope.pb.go @@ -1,28 +1,25 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: envelope.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/envelope.proto -package record_pb +package pb import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - - proto "github.com/gogo/protobuf/proto" pb "github.com/libp2p/go-libp2p/core/crypto/pb" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) // Envelope encloses a signed payload produced by a peer, along with the public // key of the keypair it was signed with so that it can be statelessly validated @@ -32,6 +29,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // can be deserialized deterministically. Often, this byte string is a // multicodec. type Envelope struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // public_key is the public key of the keypair the enclosed payload was // signed with. PublicKey *pb.PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` @@ -46,460 +47,146 @@ type Envelope struct { Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *Envelope) Reset() { *m = Envelope{} } -func (m *Envelope) String() string { return proto.CompactTextString(m) } -func (*Envelope) ProtoMessage() {} -func (*Envelope) Descriptor() ([]byte, []int) { - return fileDescriptor_ee266e8c558e9dc5, []int{0} -} -func (m *Envelope) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Envelope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Envelope.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Envelope) Reset() { + *x = Envelope{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_envelope_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Envelope) XXX_Merge(src proto.Message) { - xxx_messageInfo_Envelope.Merge(m, src) -} -func (m *Envelope) XXX_Size() int { - return m.Size() -} -func (m *Envelope) XXX_DiscardUnknown() { - xxx_messageInfo_Envelope.DiscardUnknown(m) + +func (x *Envelope) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Envelope proto.InternalMessageInfo +func (*Envelope) ProtoMessage() {} -func (m *Envelope) GetPublicKey() *pb.PublicKey { - if m != nil { - return m.PublicKey +func (x *Envelope) ProtoReflect() protoreflect.Message { + mi := &file_pb_envelope_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (m *Envelope) GetPayloadType() []byte { - if m != nil { - return m.PayloadType - } - return nil +// Deprecated: Use Envelope.ProtoReflect.Descriptor instead. +func (*Envelope) Descriptor() ([]byte, []int) { + return file_pb_envelope_proto_rawDescGZIP(), []int{0} } -func (m *Envelope) GetPayload() []byte { - if m != nil { - return m.Payload +func (x *Envelope) GetPublicKey() *pb.PublicKey { + if x != nil { + return x.PublicKey } return nil } -func (m *Envelope) GetSignature() []byte { - if m != nil { - return m.Signature +func (x *Envelope) GetPayloadType() []byte { + if x != nil { + return x.PayloadType } return nil } -func init() { - proto.RegisterType((*Envelope)(nil), "record.pb.Envelope") -} - -func init() { proto.RegisterFile("envelope.proto", fileDescriptor_ee266e8c558e9dc5) } - -var fileDescriptor_ee266e8c558e9dc5 = []byte{ - // 205 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, 0x2c, 0x4a, 0x4d, 0xce, - 0x2f, 0x4a, 0xd1, 0x2b, 0x48, 0x92, 0x12, 0x4b, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x2f, 0x48, - 0xd2, 0x87, 0xb0, 0x20, 0x4a, 0x94, 0x66, 0x31, 0x72, 0x71, 0xb8, 0x42, 0x75, 0x09, 0x19, 0x73, - 0x71, 0x15, 0x94, 0x26, 0xe5, 0x64, 0x26, 0xc7, 0x67, 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, - 0x70, 0x1b, 0x89, 0xe8, 0xc1, 0xd4, 0x27, 0xe9, 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, 0xc1, 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, 0xbb, 0xde, 0x18, - 0x10, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x0b, 0xd9, 0x6d, 0xf2, 0x00, 0x00, 0x00, -} - -func (m *Envelope) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *Envelope) GetPayload() []byte { + if x != nil { + return x.Payload } - return dAtA[:n], nil -} - -func (m *Envelope) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return nil } -func (m *Envelope) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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] = 0x2a +func (x *Envelope) GetSignature() []byte { + if x != nil { + return x.Signature } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = encodeVarintEnvelope(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0x1a - } - 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 - } - 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 + return 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 base -} -func (m *Envelope) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublicKey != nil { - l = m.PublicKey.Size() - n += 1 + l + sovEnvelope(uint64(l)) - } - l = len(m.PayloadType) - if l > 0 { - n += 1 + l + sovEnvelope(uint64(l)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovEnvelope(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovEnvelope(uint64(l)) - } - return n -} +var File_pb_envelope_proto protoreflect.FileDescriptor -func sovEnvelope(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozEnvelope(x uint64) (n int) { - return sovEnvelope(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +var file_pb_envelope_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x70, 0x62, 0x2f, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x62, 0x1a, 0x1b, + 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x2f, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x01, 0x0a, 0x08, + 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, + 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func (m *Envelope) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEnvelope - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Envelope: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Envelope: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEnvelope - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEnvelope - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEnvelope - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PublicKey == nil { - m.PublicKey = &pb.PublicKey{} - } - if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PayloadType", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEnvelope - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEnvelope - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEnvelope - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PayloadType = append(m.PayloadType[:0], dAtA[iNdEx:postIndex]...) - if m.PayloadType == nil { - m.PayloadType = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEnvelope - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEnvelope - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEnvelope - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEnvelope - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEnvelope - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEnvelope - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEnvelope(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEnvelope - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthEnvelope - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -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 { - if shift >= 64 { - return 0, ErrIntOverflowEnvelope - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEnvelope - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEnvelope - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthEnvelope - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupEnvelope +var ( + file_pb_envelope_proto_rawDescOnce sync.Once + file_pb_envelope_proto_rawDescData = file_pb_envelope_proto_rawDesc +) + +func file_pb_envelope_proto_rawDescGZIP() []byte { + file_pb_envelope_proto_rawDescOnce.Do(func() { + file_pb_envelope_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_envelope_proto_rawDescData) + }) + return file_pb_envelope_proto_rawDescData +} + +var file_pb_envelope_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pb_envelope_proto_goTypes = []interface{}{ + (*Envelope)(nil), // 0: record.pb.Envelope + (*pb.PublicKey)(nil), // 1: crypto.pb.PublicKey +} +var file_pb_envelope_proto_depIdxs = []int32{ + 1, // 0: record.pb.Envelope.public_key:type_name -> crypto.pb.PublicKey + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pb_envelope_proto_init() } +func file_pb_envelope_proto_init() { + if File_pb_envelope_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_envelope_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Envelope); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthEnvelope - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_envelope_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_envelope_proto_goTypes, + DependencyIndexes: file_pb_envelope_proto_depIdxs, + MessageInfos: file_pb_envelope_proto_msgTypes, + }.Build() + File_pb_envelope_proto = out.File + file_pb_envelope_proto_rawDesc = nil + file_pb_envelope_proto_goTypes = nil + file_pb_envelope_proto_depIdxs = nil } - -var ( - ErrInvalidLengthEnvelope = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEnvelope = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupEnvelope = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core/record/pb/envelope.proto b/core/record/pb/envelope.proto index ca3555fbf7..05071ccd71 100644 --- a/core/record/pb/envelope.proto +++ b/core/record/pb/envelope.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package record.pb; -import "crypto/pb/crypto.proto"; +import "core/crypto/pb/crypto.proto"; // Envelope encloses a signed payload produced by a peer, along with the public // key of the keypair it was signed with so that it can be statelessly validated diff --git a/core/sec/insecure/insecure.go b/core/sec/insecure/insecure.go index d2487a3b0a..9b3664e202 100644 --- a/core/sec/insecure/insecure.go +++ b/core/sec/insecure/insecure.go @@ -14,11 +14,15 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/protocol" "github.com/libp2p/go-libp2p/core/sec" - pb "github.com/libp2p/go-libp2p/core/sec/insecure/pb" + "github.com/libp2p/go-libp2p/core/sec/insecure/pb" "github.com/libp2p/go-msgio" + + "google.golang.org/protobuf/proto" ) +//go:generate protoc --proto_path=$PWD:$PWD/../../.. --go_out=. --go_opt=Mpb/plaintext.proto=./pb pb/plaintext.proto + // ID is the multistream-select protocol ID that should be used when identifying // this security transport. const ID = "/plaintext/2.0.0" @@ -190,7 +194,7 @@ func (ic *Conn) runHandshakeSync() error { func readWriteMsg(rw io.ReadWriter, out *pb.Exchange) (*pb.Exchange, error) { const maxMessageSize = 1 << 16 - outBytes, err := out.Marshal() + outBytes, err := proto.Marshal(out) if err != nil { return nil, err } @@ -201,7 +205,7 @@ func readWriteMsg(rw io.ReadWriter, out *pb.Exchange) (*pb.Exchange, error) { }() r := msgio.NewVarintReaderSize(rw, maxMessageSize) - msg, err1 := r.ReadMsg() + b, err1 := r.ReadMsg() // Always wait for the read to finish. err2 := <-wresult @@ -210,11 +214,11 @@ func readWriteMsg(rw io.ReadWriter, out *pb.Exchange) (*pb.Exchange, error) { return nil, err1 } if err2 != nil { - r.ReleaseMsg(msg) + r.ReleaseMsg(b) return nil, err2 } inMsg := new(pb.Exchange) - err = inMsg.Unmarshal(msg) + err = proto.Unmarshal(b, inMsg) return inMsg, err } diff --git a/core/sec/insecure/pb/Makefile b/core/sec/insecure/pb/Makefile deleted file mode 100644 index 4fb825a4bb..0000000000 --- a/core/sec/insecure/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:../../../crypto/pb:. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/core/sec/insecure/pb/plaintext.pb.go b/core/sec/insecure/pb/plaintext.pb.go index cd8719d110..8642c205bc 100644 --- a/core/sec/insecure/pb/plaintext.pb.go +++ b/core/sec/insecure/pb/plaintext.pb.go @@ -1,383 +1,156 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: plaintext.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/plaintext.proto -package plaintext_pb +package pb import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - - proto "github.com/gogo/protobuf/proto" pb "github.com/libp2p/go-libp2p/core/crypto/pb" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Exchange struct { - Id []byte `protobuf:"bytes,1,opt,name=id" json:"id"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` Pubkey *pb.PublicKey `protobuf:"bytes,2,opt,name=pubkey" json:"pubkey,omitempty"` } -func (m *Exchange) Reset() { *m = Exchange{} } -func (m *Exchange) String() string { return proto.CompactTextString(m) } -func (*Exchange) ProtoMessage() {} -func (*Exchange) Descriptor() ([]byte, []int) { - return fileDescriptor_aba144f73931b711, []int{0} +func (x *Exchange) Reset() { + *x = Exchange{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_plaintext_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Exchange) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *Exchange) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Exchange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Exchange.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*Exchange) ProtoMessage() {} + +func (x *Exchange) ProtoReflect() protoreflect.Message { + mi := &file_pb_plaintext_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Exchange) XXX_Merge(src proto.Message) { - xxx_messageInfo_Exchange.Merge(m, src) -} -func (m *Exchange) XXX_Size() int { - return m.Size() -} -func (m *Exchange) XXX_DiscardUnknown() { - xxx_messageInfo_Exchange.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Exchange proto.InternalMessageInfo +// Deprecated: Use Exchange.ProtoReflect.Descriptor instead. +func (*Exchange) Descriptor() ([]byte, []int) { + return file_pb_plaintext_proto_rawDescGZIP(), []int{0} +} -func (m *Exchange) GetId() []byte { - if m != nil { - return m.Id +func (x *Exchange) GetId() []byte { + if x != nil { + return x.Id } return nil } -func (m *Exchange) GetPubkey() *pb.PublicKey { - if m != nil { - return m.Pubkey +func (x *Exchange) GetPubkey() *pb.PublicKey { + if x != nil { + return x.Pubkey } return nil } -func init() { - proto.RegisterType((*Exchange)(nil), "plaintext.pb.Exchange") -} - -func init() { proto.RegisterFile("plaintext.proto", fileDescriptor_aba144f73931b711) } - -var fileDescriptor_aba144f73931b711 = []byte{ - // 187 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0xc8, 0x49, 0xcc, - 0xcc, 0x2b, 0x49, 0xad, 0x28, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x41, 0x12, 0x48, - 0x92, 0x32, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xc9, 0x4c, - 0x2a, 0x30, 0x2a, 0xd0, 0x4f, 0xcf, 0xd7, 0x85, 0xb0, 0x74, 0x93, 0xf3, 0x8b, 0x52, 0xf5, 0x93, - 0x8b, 0x2a, 0x0b, 0x4a, 0xf2, 0xf5, 0x0b, 0x92, 0xa0, 0x2c, 0x88, 0x31, 0x4a, 0x7e, 0x5c, 0x1c, - 0xae, 0x15, 0xc9, 0x19, 0x89, 0x79, 0xe9, 0xa9, 0x42, 0x22, 0x5c, 0x4c, 0x99, 0x29, 0x12, 0x8c, - 0x0a, 0x8c, 0x1a, 0x3c, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x31, 0x65, 0xa6, 0x08, 0xe9, - 0x70, 0xb1, 0x15, 0x94, 0x26, 0x65, 0xa7, 0x56, 0x4a, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x89, - 0xe8, 0xc1, 0x0c, 0x48, 0xd2, 0x0b, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xf6, 0x4e, 0xad, 0x0c, 0x82, - 0xaa, 0x71, 0x92, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, - 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x06, 0x40, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x40, 0xde, 0x90, 0x0b, 0xc2, 0x00, 0x00, 0x00, -} - -func (m *Exchange) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} +var File_pb_plaintext_proto protoreflect.FileDescriptor -func (m *Exchange) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +var file_pb_plaintext_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x62, 0x2f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, + 0x70, 0x62, 0x1a, 0x1b, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, + 0x70, 0x62, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x48, 0x0a, 0x08, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x06, 0x70, + 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, + 0x79, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, } -func (m *Exchange) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pubkey != nil { - { - size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPlaintext(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Id != nil { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintPlaintext(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} +var ( + file_pb_plaintext_proto_rawDescOnce sync.Once + file_pb_plaintext_proto_rawDescData = file_pb_plaintext_proto_rawDesc +) -func encodeVarintPlaintext(dAtA []byte, offset int, v uint64) int { - offset -= sovPlaintext(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Exchange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != nil { - l = len(m.Id) - n += 1 + l + sovPlaintext(uint64(l)) - } - if m.Pubkey != nil { - l = m.Pubkey.Size() - n += 1 + l + sovPlaintext(uint64(l)) - } - return n +func file_pb_plaintext_proto_rawDescGZIP() []byte { + file_pb_plaintext_proto_rawDescOnce.Do(func() { + file_pb_plaintext_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_plaintext_proto_rawDescData) + }) + return file_pb_plaintext_proto_rawDescData } -func sovPlaintext(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +var file_pb_plaintext_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pb_plaintext_proto_goTypes = []interface{}{ + (*Exchange)(nil), // 0: plaintext.pb.Exchange + (*pb.PublicKey)(nil), // 1: crypto.pb.PublicKey } -func sozPlaintext(x uint64) (n int) { - return sovPlaintext(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +var file_pb_plaintext_proto_depIdxs = []int32{ + 1, // 0: plaintext.pb.Exchange.pubkey:type_name -> crypto.pb.PublicKey + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } -func (m *Exchange) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlaintext - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Exchange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Exchange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlaintext - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPlaintext - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPlaintext - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlaintext - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlaintext - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPlaintext - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pubkey == nil { - m.Pubkey = &pb.PublicKey{} - } - if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlaintext(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlaintext - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPlaintext - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func init() { file_pb_plaintext_proto_init() } +func file_pb_plaintext_proto_init() { + if File_pb_plaintext_proto != nil { + return } - return nil -} -func skipPlaintext(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 { - if shift >= 64 { - return 0, ErrIntOverflowPlaintext - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPlaintext - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPlaintext - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthPlaintext + if !protoimpl.UnsafeEnabled { + file_pb_plaintext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Exchange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPlaintext - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthPlaintext - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_plaintext_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_plaintext_proto_goTypes, + DependencyIndexes: file_pb_plaintext_proto_depIdxs, + MessageInfos: file_pb_plaintext_proto_msgTypes, + }.Build() + File_pb_plaintext_proto = out.File + file_pb_plaintext_proto_rawDesc = nil + file_pb_plaintext_proto_goTypes = nil + file_pb_plaintext_proto_depIdxs = nil } - -var ( - ErrInvalidLengthPlaintext = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPlaintext = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPlaintext = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core/sec/insecure/pb/plaintext.proto b/core/sec/insecure/pb/plaintext.proto index 0e792b3cf5..634100bdc1 100644 --- a/core/sec/insecure/pb/plaintext.proto +++ b/core/sec/insecure/pb/plaintext.proto @@ -2,7 +2,7 @@ syntax = "proto2"; package plaintext.pb; -import "github.com/libp2p/go-libp2p/core/crypto/pb/crypto.proto"; +import "core/crypto/pb/crypto.proto"; message Exchange { optional bytes id = 1; diff --git a/go.mod b/go.mod index 99409b07d4..0102bb77aa 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 github.com/flynn/noise v1.0.0 - github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.6.0 github.com/google/gopacket v1.1.19 github.com/gorilla/websocket v1.5.0 @@ -24,7 +23,7 @@ require ( github.com/libp2p/go-libp2p-asn-util v0.2.0 github.com/libp2p/go-libp2p-testing v0.12.0 github.com/libp2p/go-mplex v0.7.0 - github.com/libp2p/go-msgio v0.2.0 + github.com/libp2p/go-msgio v0.2.1-0.20230108031931-b267c299b17c github.com/libp2p/go-nat v0.1.0 github.com/libp2p/go-netroute v0.2.1 github.com/libp2p/go-reuseport v0.2.0 @@ -55,6 +54,7 @@ require ( golang.org/x/crypto v0.3.0 golang.org/x/sync v0.1.0 golang.org/x/sys v0.3.0 + google.golang.org/protobuf v1.28.1 ) require ( @@ -74,6 +74,7 @@ require ( github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect github.com/google/pprof v0.0.0-20221203041831-ce31453925ec // indirect @@ -111,7 +112,6 @@ require ( golang.org/x/net v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect golang.org/x/tools v0.3.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.1.7 // indirect ) diff --git a/go.sum b/go.sum index 72105406d6..414b57cb02 100644 --- a/go.sum +++ b/go.sum @@ -305,8 +305,8 @@ github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUI github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY= github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU= -github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= -github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-msgio v0.2.1-0.20230108031931-b267c299b17c h1:e9fC/sWHRnqszcFld9xonCsQy/YNkfZvjDkU0bHTmSM= +github.com/libp2p/go-msgio v0.2.1-0.20230108031931-b267c299b17c/go.mod h1:WKuKAKDGyBMTHwc4U8nsWmNwslcm82MMjQJP+pvxNXY= github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg= github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= diff --git a/p2p/host/autonat/pb/Makefile b/p2p/host/autonat/pb/Makefile deleted file mode 100644 index dd21e878f8..0000000000 --- a/p2p/host/autonat/pb/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -pbgos := $(patsubst %.proto,%.pb.go,$(wildcard *.proto)) - -all: $(pbgos) - -%.pb.go: %.proto - protoc --gogofast_out=. --proto_path=$(GOPATH)/src:. $< diff --git a/p2p/host/autonat/pb/autonat.pb.go b/p2p/host/autonat/pb/autonat.pb.go index a22b5e99e3..d452ec56b8 100644 --- a/p2p/host/autonat/pb/autonat.pb.go +++ b/p2p/host/autonat/pb/autonat.pb.go @@ -1,26 +1,24 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: autonat.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/autonat.proto -package autonat_pb +package pb import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Message_MessageType int32 @@ -29,15 +27,17 @@ const ( Message_DIAL_RESPONSE Message_MessageType = 1 ) -var Message_MessageType_name = map[int32]string{ - 0: "DIAL", - 1: "DIAL_RESPONSE", -} - -var Message_MessageType_value = map[string]int32{ - "DIAL": 0, - "DIAL_RESPONSE": 1, -} +// Enum value maps for Message_MessageType. +var ( + Message_MessageType_name = map[int32]string{ + 0: "DIAL", + 1: "DIAL_RESPONSE", + } + Message_MessageType_value = map[string]int32{ + "DIAL": 0, + "DIAL_RESPONSE": 1, + } +) func (x Message_MessageType) Enum() *Message_MessageType { p := new(Message_MessageType) @@ -46,20 +46,34 @@ func (x Message_MessageType) Enum() *Message_MessageType { } func (x Message_MessageType) String() string { - return proto.EnumName(Message_MessageType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Message_MessageType) Descriptor() protoreflect.EnumDescriptor { + return file_pb_autonat_proto_enumTypes[0].Descriptor() +} + +func (Message_MessageType) Type() protoreflect.EnumType { + return &file_pb_autonat_proto_enumTypes[0] +} + +func (x Message_MessageType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } -func (x *Message_MessageType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Message_MessageType_value, data, "Message_MessageType") +// Deprecated: Do not use. +func (x *Message_MessageType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = Message_MessageType(value) + *x = Message_MessageType(num) return nil } +// Deprecated: Use Message_MessageType.Descriptor instead. func (Message_MessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 0} + return file_pb_autonat_proto_rawDescGZIP(), []int{0, 0} } type Message_ResponseStatus int32 @@ -72,21 +86,23 @@ const ( Message_E_INTERNAL_ERROR Message_ResponseStatus = 300 ) -var Message_ResponseStatus_name = map[int32]string{ - 0: "OK", - 100: "E_DIAL_ERROR", - 101: "E_DIAL_REFUSED", - 200: "E_BAD_REQUEST", - 300: "E_INTERNAL_ERROR", -} - -var Message_ResponseStatus_value = map[string]int32{ - "OK": 0, - "E_DIAL_ERROR": 100, - "E_DIAL_REFUSED": 101, - "E_BAD_REQUEST": 200, - "E_INTERNAL_ERROR": 300, -} +// Enum value maps for Message_ResponseStatus. +var ( + Message_ResponseStatus_name = map[int32]string{ + 0: "OK", + 100: "E_DIAL_ERROR", + 101: "E_DIAL_REFUSED", + 200: "E_BAD_REQUEST", + 300: "E_INTERNAL_ERROR", + } + Message_ResponseStatus_value = map[string]int32{ + "OK": 0, + "E_DIAL_ERROR": 100, + "E_DIAL_REFUSED": 101, + "E_BAD_REQUEST": 200, + "E_INTERNAL_ERROR": 300, + } +) func (x Message_ResponseStatus) Enum() *Message_ResponseStatus { p := new(Message_ResponseStatus) @@ -95,1152 +111,414 @@ func (x Message_ResponseStatus) Enum() *Message_ResponseStatus { } func (x Message_ResponseStatus) String() string { - return proto.EnumName(Message_ResponseStatus_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Message_ResponseStatus) Descriptor() protoreflect.EnumDescriptor { + return file_pb_autonat_proto_enumTypes[1].Descriptor() } -func (x *Message_ResponseStatus) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Message_ResponseStatus_value, data, "Message_ResponseStatus") +func (Message_ResponseStatus) Type() protoreflect.EnumType { + return &file_pb_autonat_proto_enumTypes[1] +} + +func (x Message_ResponseStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Message_ResponseStatus) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = Message_ResponseStatus(value) + *x = Message_ResponseStatus(num) return nil } +// Deprecated: Use Message_ResponseStatus.Descriptor instead. func (Message_ResponseStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 1} + return file_pb_autonat_proto_rawDescGZIP(), []int{0, 1} } type Message struct { - Type *Message_MessageType `protobuf:"varint,1,opt,name=type,enum=autonat.pb.Message_MessageType" json:"type,omitempty"` - Dial *Message_Dial `protobuf:"bytes,2,opt,name=dial" json:"dial,omitempty"` - DialResponse *Message_DialResponse `protobuf:"bytes,3,opt,name=dialResponse" json:"dialResponse,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0} -} -func (m *Message) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) -} -func (m *Message) XXX_Size() int { - return m.Size() + Type *Message_MessageType `protobuf:"varint,1,opt,name=type,enum=autonat.pb.Message_MessageType" json:"type,omitempty"` + Dial *Message_Dial `protobuf:"bytes,2,opt,name=dial" json:"dial,omitempty"` + DialResponse *Message_DialResponse `protobuf:"bytes,3,opt,name=dialResponse" json:"dialResponse,omitempty"` } -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_Message proto.InternalMessageInfo -func (m *Message) GetType() Message_MessageType { - if m != nil && m.Type != nil { - return *m.Type +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_autonat_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return Message_DIAL } -func (m *Message) GetDial() *Message_Dial { - if m != nil { - return m.Dial - } - return nil +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Message) GetDialResponse() *Message_DialResponse { - if m != nil { - return m.DialResponse +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_pb_autonat_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -type Message_PeerInfo struct { - Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use Message.ProtoReflect.Descriptor instead. +func (*Message) Descriptor() ([]byte, []int) { + return file_pb_autonat_proto_rawDescGZIP(), []int{0} } -func (m *Message_PeerInfo) Reset() { *m = Message_PeerInfo{} } -func (m *Message_PeerInfo) String() string { return proto.CompactTextString(m) } -func (*Message_PeerInfo) ProtoMessage() {} -func (*Message_PeerInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 0} -} -func (m *Message_PeerInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_PeerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_PeerInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Message) GetType() Message_MessageType { + if x != nil && x.Type != nil { + return *x.Type } -} -func (m *Message_PeerInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_PeerInfo.Merge(m, src) -} -func (m *Message_PeerInfo) XXX_Size() int { - return m.Size() -} -func (m *Message_PeerInfo) XXX_DiscardUnknown() { - xxx_messageInfo_Message_PeerInfo.DiscardUnknown(m) + return Message_DIAL } -var xxx_messageInfo_Message_PeerInfo proto.InternalMessageInfo - -func (m *Message_PeerInfo) GetId() []byte { - if m != nil { - return m.Id +func (x *Message) GetDial() *Message_Dial { + if x != nil { + return x.Dial } return nil } -func (m *Message_PeerInfo) GetAddrs() [][]byte { - if m != nil { - return m.Addrs +func (x *Message) GetDialResponse() *Message_DialResponse { + if x != nil { + return x.DialResponse } return nil } -type Message_Dial struct { - Peer *Message_PeerInfo `protobuf:"bytes,1,opt,name=peer" json:"peer,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +type Message_PeerInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Message_Dial) Reset() { *m = Message_Dial{} } -func (m *Message_Dial) String() string { return proto.CompactTextString(m) } -func (*Message_Dial) ProtoMessage() {} -func (*Message_Dial) Descriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 1} -} -func (m *Message_Dial) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_Dial) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_Dial.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message_Dial) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_Dial.Merge(m, src) -} -func (m *Message_Dial) XXX_Size() int { - return m.Size() -} -func (m *Message_Dial) XXX_DiscardUnknown() { - xxx_messageInfo_Message_Dial.DiscardUnknown(m) + Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` } -var xxx_messageInfo_Message_Dial proto.InternalMessageInfo - -func (m *Message_Dial) GetPeer() *Message_PeerInfo { - if m != nil { - return m.Peer +func (x *Message_PeerInfo) Reset() { + *x = Message_PeerInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_autonat_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -type Message_DialResponse struct { - Status *Message_ResponseStatus `protobuf:"varint,1,opt,name=status,enum=autonat.pb.Message_ResponseStatus" json:"status,omitempty"` - StatusText *string `protobuf:"bytes,2,opt,name=statusText" json:"statusText,omitempty"` - Addr []byte `protobuf:"bytes,3,opt,name=addr" json:"addr,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *Message_PeerInfo) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Message_DialResponse) Reset() { *m = Message_DialResponse{} } -func (m *Message_DialResponse) String() string { return proto.CompactTextString(m) } -func (*Message_DialResponse) ProtoMessage() {} -func (*Message_DialResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 2} -} -func (m *Message_DialResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_DialResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_DialResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (*Message_PeerInfo) ProtoMessage() {} + +func (x *Message_PeerInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_autonat_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Message_DialResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_DialResponse.Merge(m, src) -} -func (m *Message_DialResponse) XXX_Size() int { - return m.Size() -} -func (m *Message_DialResponse) XXX_DiscardUnknown() { - xxx_messageInfo_Message_DialResponse.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Message_DialResponse proto.InternalMessageInfo - -func (m *Message_DialResponse) GetStatus() Message_ResponseStatus { - if m != nil && m.Status != nil { - return *m.Status - } - return Message_OK +// Deprecated: Use Message_PeerInfo.ProtoReflect.Descriptor instead. +func (*Message_PeerInfo) Descriptor() ([]byte, []int) { + return file_pb_autonat_proto_rawDescGZIP(), []int{0, 0} } -func (m *Message_DialResponse) GetStatusText() string { - if m != nil && m.StatusText != nil { - return *m.StatusText +func (x *Message_PeerInfo) GetId() []byte { + if x != nil { + return x.Id } - return "" + return nil } -func (m *Message_DialResponse) GetAddr() []byte { - if m != nil { - return m.Addr +func (x *Message_PeerInfo) GetAddrs() [][]byte { + if x != nil { + return x.Addrs } return nil } -func init() { - proto.RegisterEnum("autonat.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value) - proto.RegisterEnum("autonat.pb.Message_ResponseStatus", Message_ResponseStatus_name, Message_ResponseStatus_value) - proto.RegisterType((*Message)(nil), "autonat.pb.Message") - proto.RegisterType((*Message_PeerInfo)(nil), "autonat.pb.Message.PeerInfo") - proto.RegisterType((*Message_Dial)(nil), "autonat.pb.Message.Dial") - proto.RegisterType((*Message_DialResponse)(nil), "autonat.pb.Message.DialResponse") -} +type Message_Dial struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func init() { proto.RegisterFile("autonat.proto", fileDescriptor_a04e278ef61ac07a) } - -var fileDescriptor_a04e278ef61ac07a = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xcf, 0x8a, 0xda, 0x50, - 0x14, 0xc6, 0xbd, 0x31, 0xb5, 0xf6, 0x18, 0xc3, 0xed, 0xa1, 0x85, 0x20, 0x25, 0x0d, 0x59, 0x49, - 0x29, 0x22, 0x76, 0x53, 0xba, 0x53, 0x72, 0x0b, 0xd2, 0x56, 0xed, 0x49, 0x5c, 0x87, 0x94, 0xdc, - 0x0e, 0x01, 0x31, 0x21, 0x89, 0x30, 0x6e, 0xe6, 0x89, 0x66, 0x3b, 0xef, 0xe0, 0x72, 0x1e, 0x61, - 0xf0, 0x49, 0x86, 0x5c, 0xa3, 0xa3, 0xe0, 0xac, 0xce, 0x1f, 0x7e, 0xdf, 0x39, 0x1f, 0x1f, 0x74, - 0xa3, 0x4d, 0x99, 0xae, 0xa3, 0x72, 0x90, 0xe5, 0x69, 0x99, 0x22, 0x9c, 0xc6, 0x7f, 0xee, 0x83, - 0x0e, 0x6f, 0xff, 0xc8, 0xa2, 0x88, 0x6e, 0x24, 0x7e, 0x03, 0xbd, 0xdc, 0x66, 0xd2, 0x62, 0x0e, - 0xeb, 0x9b, 0xa3, 0xcf, 0x83, 0x17, 0x6c, 0x50, 0x23, 0xc7, 0x1a, 0x6c, 0x33, 0x49, 0x0a, 0xc6, - 0xaf, 0xa0, 0xc7, 0x49, 0xb4, 0xb2, 0x34, 0x87, 0xf5, 0x3b, 0x23, 0xeb, 0x9a, 0xc8, 0x4b, 0xa2, - 0x15, 0x29, 0x0a, 0x3d, 0x30, 0xaa, 0x4a, 0xb2, 0xc8, 0xd2, 0x75, 0x21, 0xad, 0xa6, 0x52, 0x39, - 0xaf, 0xaa, 0x6a, 0x8e, 0x2e, 0x54, 0xbd, 0x21, 0xb4, 0x17, 0x52, 0xe6, 0xd3, 0xf5, 0xff, 0x14, - 0x4d, 0xd0, 0x92, 0x58, 0x59, 0x36, 0x48, 0x4b, 0x62, 0xfc, 0x00, 0x6f, 0xa2, 0x38, 0xce, 0x0b, - 0x4b, 0x73, 0x9a, 0x7d, 0x83, 0x0e, 0x43, 0xef, 0x3b, 0xe8, 0xd5, 0x3d, 0x1c, 0x82, 0x9e, 0x49, - 0x99, 0x2b, 0xbe, 0x33, 0xfa, 0x74, 0xed, 0xef, 0xf1, 0x32, 0x29, 0xb2, 0x77, 0x07, 0xc6, 0xb9, - 0x13, 0xfc, 0x01, 0xad, 0xa2, 0x8c, 0xca, 0x4d, 0x51, 0xc7, 0xe4, 0x5e, 0xbb, 0x71, 0xa4, 0x7d, - 0x45, 0x52, 0xad, 0x40, 0x1b, 0xe0, 0xd0, 0x05, 0xf2, 0xb6, 0x54, 0x89, 0xbd, 0xa3, 0xb3, 0x0d, - 0x22, 0xe8, 0x95, 0x5d, 0x95, 0x8a, 0x41, 0xaa, 0x77, 0xbf, 0x40, 0xe7, 0x2c, 0x74, 0x6c, 0x83, - 0xee, 0x4d, 0xc7, 0xbf, 0x79, 0x03, 0xdf, 0x43, 0xb7, 0xea, 0x42, 0x12, 0xfe, 0x62, 0x3e, 0xf3, - 0x05, 0x67, 0x6e, 0x02, 0xe6, 0xe5, 0x67, 0x6c, 0x81, 0x36, 0xff, 0xc5, 0x1b, 0xc8, 0xc1, 0x10, - 0xa1, 0xc2, 0x05, 0xd1, 0x9c, 0x78, 0x8c, 0x08, 0x66, 0xbd, 0x21, 0xf1, 0x73, 0xe9, 0x0b, 0x8f, - 0x4b, 0x44, 0xe8, 0x8a, 0x70, 0x32, 0xf6, 0x42, 0x12, 0x7f, 0x97, 0xc2, 0x0f, 0xf8, 0x8e, 0xe1, - 0x47, 0xe0, 0x22, 0x9c, 0xce, 0x02, 0x41, 0xb3, 0x93, 0xfa, 0x5e, 0x9b, 0x18, 0xbb, 0xbd, 0xcd, - 0x1e, 0xf7, 0x36, 0x7b, 0xda, 0xdb, 0xec, 0x39, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xe2, 0x93, 0x4e, - 0x61, 0x02, 0x00, 0x00, + Peer *Message_PeerInfo `protobuf:"bytes,1,opt,name=peer" json:"peer,omitempty"` } -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *Message_Dial) Reset() { + *x = Message_Dial{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_autonat_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return dAtA[:n], nil } -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *Message_Dial) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.DialResponse != nil { - { - size, err := m.DialResponse.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAutonat(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Dial != nil { - { - size, err := m.Dial.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAutonat(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Type != nil { - i = encodeVarintAutonat(dAtA, i, uint64(*m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} +func (*Message_Dial) ProtoMessage() {} -func (m *Message_PeerInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message_PeerInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_PeerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Addrs) > 0 { - for iNdEx := len(m.Addrs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addrs[iNdEx]) - copy(dAtA[i:], m.Addrs[iNdEx]) - i = encodeVarintAutonat(dAtA, i, uint64(len(m.Addrs[iNdEx]))) - i-- - dAtA[i] = 0x12 +func (x *Message_Dial) ProtoReflect() protoreflect.Message { + mi := &file_pb_autonat_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if m.Id != nil { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintAutonat(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Message_Dial) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil + return mi.MessageOf(x) } -func (m *Message_Dial) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// Deprecated: Use Message_Dial.ProtoReflect.Descriptor instead. +func (*Message_Dial) Descriptor() ([]byte, []int) { + return file_pb_autonat_proto_rawDescGZIP(), []int{0, 1} } -func (m *Message_Dial) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Peer != nil { - { - size, err := m.Peer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAutonat(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (x *Message_Dial) GetPeer() *Message_PeerInfo { + if x != nil { + return x.Peer } - return len(dAtA) - i, nil + return nil } -func (m *Message_DialResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} +type Message_DialResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Message_DialResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + Status *Message_ResponseStatus `protobuf:"varint,1,opt,name=status,enum=autonat.pb.Message_ResponseStatus" json:"status,omitempty"` + StatusText *string `protobuf:"bytes,2,opt,name=statusText" json:"statusText,omitempty"` + Addr []byte `protobuf:"bytes,3,opt,name=addr" json:"addr,omitempty"` } -func (m *Message_DialResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Addr != nil { - i -= len(m.Addr) - copy(dAtA[i:], m.Addr) - i = encodeVarintAutonat(dAtA, i, uint64(len(m.Addr))) - i-- - dAtA[i] = 0x1a +func (x *Message_DialResponse) Reset() { + *x = Message_DialResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_autonat_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - if m.StatusText != nil { - i -= len(*m.StatusText) - copy(dAtA[i:], *m.StatusText) - i = encodeVarintAutonat(dAtA, i, uint64(len(*m.StatusText))) - i-- - dAtA[i] = 0x12 - } - if m.Status != nil { - i = encodeVarintAutonat(dAtA, i, uint64(*m.Status)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil } -func encodeVarintAutonat(dAtA []byte, offset int, v uint64) int { - offset -= sovAutonat(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Message) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != nil { - n += 1 + sovAutonat(uint64(*m.Type)) - } - if m.Dial != nil { - l = m.Dial.Size() - n += 1 + l + sovAutonat(uint64(l)) - } - if m.DialResponse != nil { - l = m.DialResponse.Size() - n += 1 + l + sovAutonat(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +func (x *Message_DialResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Message_PeerInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != nil { - l = len(m.Id) - n += 1 + l + sovAutonat(uint64(l)) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - l = len(b) - n += 1 + l + sovAutonat(uint64(l)) +func (*Message_DialResponse) ProtoMessage() {} + +func (x *Message_DialResponse) ProtoReflect() protoreflect.Message { + mi := &file_pb_autonat_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return mi.MessageOf(x) } -func (m *Message_Dial) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Peer != nil { - l = m.Peer.Size() - n += 1 + l + sovAutonat(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +// Deprecated: Use Message_DialResponse.ProtoReflect.Descriptor instead. +func (*Message_DialResponse) Descriptor() ([]byte, []int) { + return file_pb_autonat_proto_rawDescGZIP(), []int{0, 2} } -func (m *Message_DialResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != nil { - n += 1 + sovAutonat(uint64(*m.Status)) - } - if m.StatusText != nil { - l = len(*m.StatusText) - n += 1 + l + sovAutonat(uint64(l)) +func (x *Message_DialResponse) GetStatus() Message_ResponseStatus { + if x != nil && x.Status != nil { + return *x.Status } - if m.Addr != nil { - l = len(m.Addr) - n += 1 + l + sovAutonat(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovAutonat(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAutonat(x uint64) (n int) { - return sovAutonat(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return Message_OK } -func (m *Message) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var v Message_MessageType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= Message_MessageType(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Type = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dial", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Dial == nil { - m.Dial = &Message_Dial{} - } - if err := m.Dial.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DialResponse", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DialResponse == nil { - m.DialResponse = &Message_DialResponse{} - } - if err := m.DialResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAutonat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *Message_DialResponse) GetStatusText() string { + if x != nil && x.StatusText != nil { + return *x.StatusText } - return nil + return "" } -func (m *Message_PeerInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PeerInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PeerInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, make([]byte, postIndex-iNdEx)) - copy(m.Addrs[len(m.Addrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAutonat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *Message_DialResponse) GetAddr() []byte { + if x != nil { + return x.Addr } return nil } -func (m *Message_Dial) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Dial: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Dial: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Peer == nil { - m.Peer = &Message_PeerInfo{} - } - if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAutonat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +var File_pb_autonat_proto protoreflect.FileDescriptor + +var file_pb_autonat_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x70, 0x62, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x6e, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0a, 0x61, 0x75, 0x74, 0x6f, 0x6e, 0x61, 0x74, 0x2e, 0x70, 0x62, 0x22, 0xb5, + 0x04, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6e, + 0x61, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x2c, 0x0a, 0x04, 0x64, 0x69, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x61, 0x75, 0x74, 0x6f, 0x6e, 0x61, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x52, 0x04, 0x64, 0x69, 0x61, 0x6c, 0x12, 0x44, 0x0a, + 0x0c, 0x64, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6e, 0x61, 0x74, 0x2e, 0x70, 0x62, + 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0c, 0x64, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x1a, 0x30, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x05, + 0x61, 0x64, 0x64, 0x72, 0x73, 0x1a, 0x38, 0x0a, 0x04, 0x44, 0x69, 0x61, 0x6c, 0x12, 0x30, 0x0a, + 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x75, + 0x74, 0x6f, 0x6e, 0x61, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x1a, + 0x7e, 0x0a, 0x0c, 0x44, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x22, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6e, 0x61, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x54, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x54, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x61, + 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x22, + 0x2a, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, + 0x0a, 0x04, 0x44, 0x49, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x49, 0x41, 0x4c, + 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x10, 0x01, 0x22, 0x69, 0x0a, 0x0e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x06, 0x0a, + 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x5f, 0x44, 0x49, 0x41, 0x4c, 0x5f, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x64, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x5f, 0x44, 0x49, 0x41, + 0x4c, 0x5f, 0x52, 0x45, 0x46, 0x55, 0x53, 0x45, 0x44, 0x10, 0x65, 0x12, 0x12, 0x0a, 0x0d, 0x45, + 0x5f, 0x42, 0x41, 0x44, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0xc8, 0x01, 0x12, + 0x15, 0x0a, 0x10, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x52, + 0x52, 0x4f, 0x52, 0x10, 0xac, 0x02, } -func (m *Message_DialResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + +var ( + file_pb_autonat_proto_rawDescOnce sync.Once + file_pb_autonat_proto_rawDescData = file_pb_autonat_proto_rawDesc +) + +func file_pb_autonat_proto_rawDescGZIP() []byte { + file_pb_autonat_proto_rawDescOnce.Do(func() { + file_pb_autonat_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_autonat_proto_rawDescData) + }) + return file_pb_autonat_proto_rawDescData +} + +var file_pb_autonat_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_pb_autonat_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_pb_autonat_proto_goTypes = []interface{}{ + (Message_MessageType)(0), // 0: autonat.pb.Message.MessageType + (Message_ResponseStatus)(0), // 1: autonat.pb.Message.ResponseStatus + (*Message)(nil), // 2: autonat.pb.Message + (*Message_PeerInfo)(nil), // 3: autonat.pb.Message.PeerInfo + (*Message_Dial)(nil), // 4: autonat.pb.Message.Dial + (*Message_DialResponse)(nil), // 5: autonat.pb.Message.DialResponse +} +var file_pb_autonat_proto_depIdxs = []int32{ + 0, // 0: autonat.pb.Message.type:type_name -> autonat.pb.Message.MessageType + 4, // 1: autonat.pb.Message.dial:type_name -> autonat.pb.Message.Dial + 5, // 2: autonat.pb.Message.dialResponse:type_name -> autonat.pb.Message.DialResponse + 3, // 3: autonat.pb.Message.Dial.peer:type_name -> autonat.pb.Message.PeerInfo + 1, // 4: autonat.pb.Message.DialResponse.status:type_name -> autonat.pb.Message.ResponseStatus + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_pb_autonat_proto_init() } +func file_pb_autonat_proto_init() { + if File_pb_autonat_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_autonat_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DialResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DialResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + file_pb_autonat_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message_PeerInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - var v Message_ResponseStatus - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= Message_ResponseStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Status = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusText", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.StatusText = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addr = append(m.Addr[:0], dAtA[iNdEx:postIndex]...) - if m.Addr == nil { - m.Addr = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAutonat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAutonat(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 { - if shift >= 64 { - return 0, ErrIntOverflowAutonat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + file_pb_autonat_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message_Dial); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAutonat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAutonat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } + file_pb_autonat_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message_DialResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - if length < 0 { - return 0, ErrInvalidLengthAutonat - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAutonat - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAutonat - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_autonat_proto_rawDesc, + NumEnums: 2, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_autonat_proto_goTypes, + DependencyIndexes: file_pb_autonat_proto_depIdxs, + EnumInfos: file_pb_autonat_proto_enumTypes, + MessageInfos: file_pb_autonat_proto_msgTypes, + }.Build() + File_pb_autonat_proto = out.File + file_pb_autonat_proto_rawDesc = nil + file_pb_autonat_proto_goTypes = nil + file_pb_autonat_proto_depIdxs = nil } - -var ( - ErrInvalidLengthAutonat = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAutonat = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAutonat = fmt.Errorf("proto: unexpected end of group") -) diff --git a/p2p/host/autonat/proto.go b/p2p/host/autonat/proto.go index 93f273cd6b..5bb2de0644 100644 --- a/p2p/host/autonat/proto.go +++ b/p2p/host/autonat/proto.go @@ -2,11 +2,13 @@ package autonat import ( "github.com/libp2p/go-libp2p/core/peer" - pb "github.com/libp2p/go-libp2p/p2p/host/autonat/pb" + "github.com/libp2p/go-libp2p/p2p/host/autonat/pb" ma "github.com/multiformats/go-multiaddr" ) +//go:generate protoc --proto_path=$PWD:$PWD/../../.. --go_out=. --go_opt=Mpb/autonat.proto=./pb pb/autonat.proto + // AutoNATProto identifies the autonat service protocol const AutoNATProto = "/libp2p/autonat/1.0.0" diff --git a/p2p/host/peerstore/pstoreds/addr_book.go b/p2p/host/peerstore/pstoreds/addr_book.go index 94f0449c73..33ff1f5e2c 100644 --- a/p2p/host/peerstore/pstoreds/addr_book.go +++ b/p2p/host/peerstore/pstoreds/addr_book.go @@ -11,7 +11,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" pstore "github.com/libp2p/go-libp2p/core/peerstore" "github.com/libp2p/go-libp2p/core/record" - pb "github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds/pb" + "github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds/pb" "github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoremem" lru "github.com/hashicorp/golang-lru/v2" @@ -20,6 +20,7 @@ import ( logging "github.com/ipfs/go-log/v2" b32 "github.com/multiformats/go-base32" ma "github.com/multiformats/go-multiaddr" + "google.golang.org/protobuf/proto" ) type ttlWriteMode int @@ -56,7 +57,7 @@ func (r *addrsRecord) flush(write ds.Write) (err error) { return err } - data, err := r.Marshal() + data, err := proto.Marshal(r) if err != nil { return err } @@ -248,7 +249,7 @@ func (ab *dsAddrBook) loadRecord(id peer.ID, cache bool, update bool) (pr *addrs err = nil pr.Id = []byte(id) case nil: - if err = pr.Unmarshal(data); err != nil { + if err := proto.Unmarshal(data, pr); err != nil { return nil, err } // this record is new and local for now (not in cache), so we don't need to lock. diff --git a/p2p/host/peerstore/pstoreds/addr_book_gc.go b/p2p/host/peerstore/pstoreds/addr_book_gc.go index 0302180594..6c7cdfbe98 100644 --- a/p2p/host/peerstore/pstoreds/addr_book_gc.go +++ b/p2p/host/peerstore/pstoreds/addr_book_gc.go @@ -7,7 +7,8 @@ import ( "time" "github.com/libp2p/go-libp2p/core/peer" - pb "github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds/pb" + "github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds/pb" + "google.golang.org/protobuf/proto" ds "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/query" @@ -232,7 +233,7 @@ func (gc *dsAddrBookGc) purgeLookahead() { dropInError(gcKey, err, "fetching entry") continue } - err = record.Unmarshal(val) + err = proto.Unmarshal(val, record) if err != nil { dropInError(gcKey, err, "unmarshalling entry") continue @@ -276,7 +277,7 @@ func (gc *dsAddrBookGc) purgeStore() { // keys: /peers/addrs/ for result := range results.Next() { record.Reset() - if err = record.Unmarshal(result.Value); err != nil { + if err = proto.Unmarshal(result.Value, record); err != nil { // TODO log continue } @@ -365,7 +366,7 @@ func (gc *dsAddrBookGc) populateLookahead() { log.Warnf("failed which getting record from store for peer: %v, err: %v", id.Pretty(), err) continue } - if err := record.Unmarshal(val); err != nil { + if err := proto.Unmarshal(val, record); err != nil { log.Warnf("failed while unmarshalling record from store for peer: %v, err: %v", id.Pretty(), err) continue } diff --git a/p2p/host/peerstore/pstoreds/pb/Makefile b/p2p/host/peerstore/pstoreds/pb/Makefile deleted file mode 100644 index 51e71f89f8..0000000000 --- a/p2p/host/peerstore/pstoreds/pb/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - -.PHONY: clean \ No newline at end of file diff --git a/p2p/host/peerstore/pstoreds/pb/pstore.pb.go b/p2p/host/peerstore/pstoreds/pb/pstore.pb.go index 794f1fdd1c..c58dbec624 100644 --- a/p2p/host/peerstore/pstoreds/pb/pstore.pb.go +++ b/p2p/host/peerstore/pstoreds/pb/pstore.pb.go @@ -1,29 +1,31 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pstore.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/pstore.proto -package pstore_pb +package pb import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) // AddrBookRecord represents a record for a peer in the address book. type AddrBookRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // The peer ID. Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // The multiaddresses. This is a sorted list where element 0 expires the soonest. @@ -32,62 +34,65 @@ type AddrBookRecord struct { CertifiedRecord *AddrBookRecord_CertifiedRecord `protobuf:"bytes,3,opt,name=certified_record,json=certifiedRecord,proto3" json:"certified_record,omitempty"` } -func (m *AddrBookRecord) Reset() { *m = AddrBookRecord{} } -func (m *AddrBookRecord) String() string { return proto.CompactTextString(m) } -func (*AddrBookRecord) ProtoMessage() {} -func (*AddrBookRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_f96873690e08a98f, []int{0} +func (x *AddrBookRecord) Reset() { + *x = AddrBookRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pstore_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AddrBookRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *AddrBookRecord) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AddrBookRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AddrBookRecord.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*AddrBookRecord) ProtoMessage() {} + +func (x *AddrBookRecord) ProtoReflect() protoreflect.Message { + mi := &file_pb_pstore_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *AddrBookRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddrBookRecord.Merge(m, src) -} -func (m *AddrBookRecord) XXX_Size() int { - return m.Size() -} -func (m *AddrBookRecord) XXX_DiscardUnknown() { - xxx_messageInfo_AddrBookRecord.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_AddrBookRecord proto.InternalMessageInfo +// Deprecated: Use AddrBookRecord.ProtoReflect.Descriptor instead. +func (*AddrBookRecord) Descriptor() ([]byte, []int) { + return file_pb_pstore_proto_rawDescGZIP(), []int{0} +} -func (m *AddrBookRecord) GetId() []byte { - if m != nil { - return m.Id +func (x *AddrBookRecord) GetId() []byte { + if x != nil { + return x.Id } return nil } -func (m *AddrBookRecord) GetAddrs() []*AddrBookRecord_AddrEntry { - if m != nil { - return m.Addrs +func (x *AddrBookRecord) GetAddrs() []*AddrBookRecord_AddrEntry { + if x != nil { + return x.Addrs } return nil } -func (m *AddrBookRecord) GetCertifiedRecord() *AddrBookRecord_CertifiedRecord { - if m != nil { - return m.CertifiedRecord +func (x *AddrBookRecord) GetCertifiedRecord() *AddrBookRecord_CertifiedRecord { + if x != nil { + return x.CertifiedRecord } return nil } // AddrEntry represents a single multiaddress. type AddrBookRecord_AddrEntry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` // The point in time when this address expires. Expiry int64 `protobuf:"varint,2,opt,name=expiry,proto3" json:"expiry,omitempty"` @@ -95,56 +100,55 @@ type AddrBookRecord_AddrEntry struct { Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` } -func (m *AddrBookRecord_AddrEntry) Reset() { *m = AddrBookRecord_AddrEntry{} } -func (m *AddrBookRecord_AddrEntry) String() string { return proto.CompactTextString(m) } -func (*AddrBookRecord_AddrEntry) ProtoMessage() {} -func (*AddrBookRecord_AddrEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_f96873690e08a98f, []int{0, 0} +func (x *AddrBookRecord_AddrEntry) Reset() { + *x = AddrBookRecord_AddrEntry{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pstore_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AddrBookRecord_AddrEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *AddrBookRecord_AddrEntry) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AddrBookRecord_AddrEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AddrBookRecord_AddrEntry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*AddrBookRecord_AddrEntry) ProtoMessage() {} + +func (x *AddrBookRecord_AddrEntry) ProtoReflect() protoreflect.Message { + mi := &file_pb_pstore_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *AddrBookRecord_AddrEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddrBookRecord_AddrEntry.Merge(m, src) -} -func (m *AddrBookRecord_AddrEntry) XXX_Size() int { - return m.Size() -} -func (m *AddrBookRecord_AddrEntry) XXX_DiscardUnknown() { - xxx_messageInfo_AddrBookRecord_AddrEntry.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_AddrBookRecord_AddrEntry proto.InternalMessageInfo +// Deprecated: Use AddrBookRecord_AddrEntry.ProtoReflect.Descriptor instead. +func (*AddrBookRecord_AddrEntry) Descriptor() ([]byte, []int) { + return file_pb_pstore_proto_rawDescGZIP(), []int{0, 0} +} -func (m *AddrBookRecord_AddrEntry) GetAddr() []byte { - if m != nil { - return m.Addr +func (x *AddrBookRecord_AddrEntry) GetAddr() []byte { + if x != nil { + return x.Addr } return nil } -func (m *AddrBookRecord_AddrEntry) GetExpiry() int64 { - if m != nil { - return m.Expiry +func (x *AddrBookRecord_AddrEntry) GetExpiry() int64 { + if x != nil { + return x.Expiry } return 0 } -func (m *AddrBookRecord_AddrEntry) GetTtl() int64 { - if m != nil { - return m.Ttl +func (x *AddrBookRecord_AddrEntry) GetTtl() int64 { + if x != nil { + return x.Ttl } return 0 } @@ -152,754 +156,176 @@ func (m *AddrBookRecord_AddrEntry) GetTtl() int64 { // CertifiedRecord contains a serialized signed PeerRecord used to // populate the signedAddrs list. type AddrBookRecord_CertifiedRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // The Seq counter from the signed PeerRecord envelope Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` // The serialized bytes of the SignedEnvelope containing the PeerRecord. Raw []byte `protobuf:"bytes,2,opt,name=raw,proto3" json:"raw,omitempty"` } -func (m *AddrBookRecord_CertifiedRecord) Reset() { *m = AddrBookRecord_CertifiedRecord{} } -func (m *AddrBookRecord_CertifiedRecord) String() string { return proto.CompactTextString(m) } -func (*AddrBookRecord_CertifiedRecord) ProtoMessage() {} -func (*AddrBookRecord_CertifiedRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_f96873690e08a98f, []int{0, 1} -} -func (m *AddrBookRecord_CertifiedRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AddrBookRecord_CertifiedRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AddrBookRecord_CertifiedRecord.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AddrBookRecord_CertifiedRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddrBookRecord_CertifiedRecord.Merge(m, src) -} -func (m *AddrBookRecord_CertifiedRecord) XXX_Size() int { - return m.Size() -} -func (m *AddrBookRecord_CertifiedRecord) XXX_DiscardUnknown() { - xxx_messageInfo_AddrBookRecord_CertifiedRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_AddrBookRecord_CertifiedRecord proto.InternalMessageInfo - -func (m *AddrBookRecord_CertifiedRecord) GetSeq() uint64 { - if m != nil { - return m.Seq +func (x *AddrBookRecord_CertifiedRecord) Reset() { + *x = AddrBookRecord_CertifiedRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pstore_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -func (m *AddrBookRecord_CertifiedRecord) GetRaw() []byte { - if m != nil { - return m.Raw - } - return nil +func (x *AddrBookRecord_CertifiedRecord) String() string { + return protoimpl.X.MessageStringOf(x) } -func init() { - proto.RegisterType((*AddrBookRecord)(nil), "pstore.pb.AddrBookRecord") - proto.RegisterType((*AddrBookRecord_AddrEntry)(nil), "pstore.pb.AddrBookRecord.AddrEntry") - proto.RegisterType((*AddrBookRecord_CertifiedRecord)(nil), "pstore.pb.AddrBookRecord.CertifiedRecord") -} - -func init() { proto.RegisterFile("pstore.proto", fileDescriptor_f96873690e08a98f) } - -var fileDescriptor_f96873690e08a98f = []byte{ - // 257 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0x2e, 0xc9, - 0x2f, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0xf1, 0x92, 0x94, 0x36, 0x33, - 0x71, 0xf1, 0x39, 0xa6, 0xa4, 0x14, 0x39, 0xe5, 0xe7, 0x67, 0x07, 0xa5, 0x26, 0xe7, 0x17, 0xa5, - 0x08, 0xf1, 0x71, 0x31, 0x65, 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x31, 0x65, 0xa6, - 0x08, 0x59, 0x72, 0xb1, 0x26, 0xa6, 0xa4, 0x14, 0x15, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, - 0x29, 0xeb, 0xc1, 0x75, 0xeb, 0xa1, 0xea, 0x04, 0x73, 0x5d, 0xf3, 0x4a, 0x8a, 0x2a, 0x83, 0x20, - 0x3a, 0x84, 0x42, 0xb8, 0x04, 0x92, 0x53, 0x8b, 0x4a, 0x32, 0xd3, 0x32, 0x53, 0x53, 0xe2, 0x8b, - 0xc0, 0x8a, 0x24, 0x98, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x34, 0x71, 0x9b, 0xe2, 0x0c, 0xd3, 0x01, - 0xe1, 0x07, 0xf1, 0x27, 0xa3, 0x0a, 0x48, 0x79, 0x72, 0x71, 0xc2, 0x6d, 0x12, 0x12, 0xe2, 0x62, - 0x01, 0xd9, 0x05, 0x75, 0x2f, 0x98, 0x2d, 0x24, 0xc6, 0xc5, 0x96, 0x5a, 0x51, 0x90, 0x59, 0x54, - 0x29, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x1c, 0x04, 0xe5, 0x09, 0x09, 0x70, 0x31, 0x97, 0x94, 0xe4, - 0x80, 0x5d, 0xc0, 0x1c, 0x04, 0x62, 0x4a, 0x99, 0x72, 0xf1, 0xa3, 0x59, 0x07, 0x52, 0x54, 0x9c, - 0x5a, 0x08, 0x36, 0x8f, 0x25, 0x08, 0xc4, 0x04, 0x89, 0x14, 0x25, 0x96, 0x83, 0xcd, 0xe2, 0x09, - 0x02, 0x31, 0x9d, 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, - 0x1c, 0xc2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x41, 0x6b, 0xe5, 0x93, 0x71, 0x01, 0x00, - 0x00, -} - -func (m *AddrBookRecord) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} +func (*AddrBookRecord_CertifiedRecord) ProtoMessage() {} -func (m *AddrBookRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AddrBookRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CertifiedRecord != nil { - { - size, err := m.CertifiedRecord.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPstore(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Addrs) > 0 { - for iNdEx := len(m.Addrs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Addrs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPstore(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 +func (x *AddrBookRecord_CertifiedRecord) ProtoReflect() protoreflect.Message { + mi := &file_pb_pstore_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintPstore(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AddrBookRecord_AddrEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AddrBookRecord_AddrEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AddrBookRecord_AddrEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Ttl != 0 { - i = encodeVarintPstore(dAtA, i, uint64(m.Ttl)) - i-- - dAtA[i] = 0x18 - } - if m.Expiry != 0 { - i = encodeVarintPstore(dAtA, i, uint64(m.Expiry)) - i-- - dAtA[i] = 0x10 - } - if len(m.Addr) > 0 { - i -= len(m.Addr) - copy(dAtA[i:], m.Addr) - i = encodeVarintPstore(dAtA, i, uint64(len(m.Addr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AddrBookRecord_CertifiedRecord) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AddrBookRecord_CertifiedRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return mi.MessageOf(x) } -func (m *AddrBookRecord_CertifiedRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Raw) > 0 { - i -= len(m.Raw) - copy(dAtA[i:], m.Raw) - i = encodeVarintPstore(dAtA, i, uint64(len(m.Raw))) - i-- - dAtA[i] = 0x12 - } - if m.Seq != 0 { - i = encodeVarintPstore(dAtA, i, uint64(m.Seq)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil +// Deprecated: Use AddrBookRecord_CertifiedRecord.ProtoReflect.Descriptor instead. +func (*AddrBookRecord_CertifiedRecord) Descriptor() ([]byte, []int) { + return file_pb_pstore_proto_rawDescGZIP(), []int{0, 1} } -func encodeVarintPstore(dAtA []byte, offset int, v uint64) int { - offset -= sovPstore(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *AddrBookRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovPstore(uint64(l)) +func (x *AddrBookRecord_CertifiedRecord) GetSeq() uint64 { + if x != nil { + return x.Seq } - if len(m.Addrs) > 0 { - for _, e := range m.Addrs { - l = e.Size() - n += 1 + l + sovPstore(uint64(l)) - } - } - if m.CertifiedRecord != nil { - l = m.CertifiedRecord.Size() - n += 1 + l + sovPstore(uint64(l)) - } - return n + return 0 } -func (m *AddrBookRecord_AddrEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Addr) - if l > 0 { - n += 1 + l + sovPstore(uint64(l)) +func (x *AddrBookRecord_CertifiedRecord) GetRaw() []byte { + if x != nil { + return x.Raw } - if m.Expiry != 0 { - n += 1 + sovPstore(uint64(m.Expiry)) - } - if m.Ttl != 0 { - n += 1 + sovPstore(uint64(m.Ttl)) - } - return n + return nil } -func (m *AddrBookRecord_CertifiedRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Seq != 0 { - n += 1 + sovPstore(uint64(m.Seq)) - } - l = len(m.Raw) - if l > 0 { - n += 1 + l + sovPstore(uint64(l)) - } - return n +var File_pb_pstore_proto protoreflect.FileDescriptor + +var file_pb_pstore_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x70, 0x62, 0x2f, 0x70, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x09, 0x70, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x62, 0x22, 0xb3, 0x02, 0x0a, + 0x0e, 0x41, 0x64, 0x64, 0x72, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x39, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x70, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x42, + 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x12, 0x54, 0x0a, 0x10, 0x63, 0x65, + 0x72, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x62, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, + 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, + 0x0f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x1a, 0x49, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, + 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64, + 0x72, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x1a, 0x35, 0x0a, 0x0f, 0x43, + 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, + 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x73, 0x65, 0x71, + 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x72, + 0x61, 0x77, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func sovPstore(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozPstore(x uint64) (n int) { - return sovPstore(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *AddrBookRecord) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AddrBookRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AddrBookRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPstore - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPstore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPstore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPstore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, &AddrBookRecord_AddrEntry{}) - if err := m.Addrs[len(m.Addrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CertifiedRecord", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPstore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPstore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CertifiedRecord == nil { - m.CertifiedRecord = &AddrBookRecord_CertifiedRecord{} - } - if err := m.CertifiedRecord.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPstore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPstore - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AddrBookRecord_AddrEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AddrEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AddrEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPstore - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPstore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addr = append(m.Addr[:0], dAtA[iNdEx:postIndex]...) - if m.Addr == nil { - m.Addr = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) - } - m.Expiry = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Expiry |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) - } - m.Ttl = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Ttl |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipPstore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPstore - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } +var ( + file_pb_pstore_proto_rawDescOnce sync.Once + file_pb_pstore_proto_rawDescData = file_pb_pstore_proto_rawDesc +) - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AddrBookRecord_CertifiedRecord) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CertifiedRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CertifiedRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) - } - m.Seq = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Seq |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPstore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } +func file_pb_pstore_proto_rawDescGZIP() []byte { + file_pb_pstore_proto_rawDescOnce.Do(func() { + file_pb_pstore_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_pstore_proto_rawDescData) + }) + return file_pb_pstore_proto_rawDescData +} + +var file_pb_pstore_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_pb_pstore_proto_goTypes = []interface{}{ + (*AddrBookRecord)(nil), // 0: pstore.pb.AddrBookRecord + (*AddrBookRecord_AddrEntry)(nil), // 1: pstore.pb.AddrBookRecord.AddrEntry + (*AddrBookRecord_CertifiedRecord)(nil), // 2: pstore.pb.AddrBookRecord.CertifiedRecord +} +var file_pb_pstore_proto_depIdxs = []int32{ + 1, // 0: pstore.pb.AddrBookRecord.addrs:type_name -> pstore.pb.AddrBookRecord.AddrEntry + 2, // 1: pstore.pb.AddrBookRecord.certified_record:type_name -> pstore.pb.AddrBookRecord.CertifiedRecord + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_pb_pstore_proto_init() } +func file_pb_pstore_proto_init() { + if File_pb_pstore_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_pstore_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddrBookRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - if byteLen < 0 { - return ErrInvalidLengthPstore - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPstore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Raw = append(m.Raw[:0], dAtA[iNdEx:postIndex]...) - if m.Raw == nil { - m.Raw = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPstore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPstore - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipPstore(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 { - if shift >= 64 { - return 0, ErrIntOverflowPstore - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + file_pb_pstore_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddrBookRecord_AddrEntry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPstore - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPstore - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthPstore - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPstore + file_pb_pstore_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddrBookRecord_CertifiedRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthPstore - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_pstore_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_pstore_proto_goTypes, + DependencyIndexes: file_pb_pstore_proto_depIdxs, + MessageInfos: file_pb_pstore_proto_msgTypes, + }.Build() + File_pb_pstore_proto = out.File + file_pb_pstore_proto_rawDesc = nil + file_pb_pstore_proto_goTypes = nil + file_pb_pstore_proto_depIdxs = nil } - -var ( - ErrInvalidLengthPstore = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPstore = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPstore = fmt.Errorf("proto: unexpected end of group") -) diff --git a/p2p/host/peerstore/pstoreds/peerstore.go b/p2p/host/peerstore/pstoreds/peerstore.go index bd54768129..be053597f6 100644 --- a/p2p/host/peerstore/pstoreds/peerstore.go +++ b/p2p/host/peerstore/pstoreds/peerstore.go @@ -15,6 +15,8 @@ import ( "github.com/multiformats/go-base32" ) +//go:generate protoc --proto_path=$PWD:$PWD/../../../.. --go_out=. --go_opt=Mpb/pstore.proto=./pb pb/pstore.proto + // Configuration object for the peerstore. type Options struct { // The size of the in-memory cache. A value of 0 or lower disables the cache. diff --git a/p2p/protocol/circuitv1/pb/Makefile b/p2p/protocol/circuitv1/pb/Makefile deleted file mode 100644 index fd11068508..0000000000 --- a/p2p/protocol/circuitv1/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/p2p/protocol/circuitv1/pb/circuitv1.pb.go b/p2p/protocol/circuitv1/pb/circuitv1.pb.go index 1715f41931..1fe5eaa91b 100644 --- a/p2p/protocol/circuitv1/pb/circuitv1.pb.go +++ b/p2p/protocol/circuitv1/pb/circuitv1.pb.go @@ -1,27 +1,24 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: circuitv1.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/circuitv1.proto -package circuitv1_pb +package pb import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type CircuitRelay_Status int32 @@ -44,43 +41,45 @@ const ( CircuitRelay_MALFORMED_MESSAGE CircuitRelay_Status = 400 ) -var CircuitRelay_Status_name = map[int32]string{ - 100: "SUCCESS", - 220: "HOP_SRC_ADDR_TOO_LONG", - 221: "HOP_DST_ADDR_TOO_LONG", - 250: "HOP_SRC_MULTIADDR_INVALID", - 251: "HOP_DST_MULTIADDR_INVALID", - 260: "HOP_NO_CONN_TO_DST", - 261: "HOP_CANT_DIAL_DST", - 262: "HOP_CANT_OPEN_DST_STREAM", - 270: "HOP_CANT_SPEAK_RELAY", - 280: "HOP_CANT_RELAY_TO_SELF", - 320: "STOP_SRC_ADDR_TOO_LONG", - 321: "STOP_DST_ADDR_TOO_LONG", - 350: "STOP_SRC_MULTIADDR_INVALID", - 351: "STOP_DST_MULTIADDR_INVALID", - 390: "STOP_RELAY_REFUSED", - 400: "MALFORMED_MESSAGE", -} - -var CircuitRelay_Status_value = map[string]int32{ - "SUCCESS": 100, - "HOP_SRC_ADDR_TOO_LONG": 220, - "HOP_DST_ADDR_TOO_LONG": 221, - "HOP_SRC_MULTIADDR_INVALID": 250, - "HOP_DST_MULTIADDR_INVALID": 251, - "HOP_NO_CONN_TO_DST": 260, - "HOP_CANT_DIAL_DST": 261, - "HOP_CANT_OPEN_DST_STREAM": 262, - "HOP_CANT_SPEAK_RELAY": 270, - "HOP_CANT_RELAY_TO_SELF": 280, - "STOP_SRC_ADDR_TOO_LONG": 320, - "STOP_DST_ADDR_TOO_LONG": 321, - "STOP_SRC_MULTIADDR_INVALID": 350, - "STOP_DST_MULTIADDR_INVALID": 351, - "STOP_RELAY_REFUSED": 390, - "MALFORMED_MESSAGE": 400, -} +// Enum value maps for CircuitRelay_Status. +var ( + CircuitRelay_Status_name = map[int32]string{ + 100: "SUCCESS", + 220: "HOP_SRC_ADDR_TOO_LONG", + 221: "HOP_DST_ADDR_TOO_LONG", + 250: "HOP_SRC_MULTIADDR_INVALID", + 251: "HOP_DST_MULTIADDR_INVALID", + 260: "HOP_NO_CONN_TO_DST", + 261: "HOP_CANT_DIAL_DST", + 262: "HOP_CANT_OPEN_DST_STREAM", + 270: "HOP_CANT_SPEAK_RELAY", + 280: "HOP_CANT_RELAY_TO_SELF", + 320: "STOP_SRC_ADDR_TOO_LONG", + 321: "STOP_DST_ADDR_TOO_LONG", + 350: "STOP_SRC_MULTIADDR_INVALID", + 351: "STOP_DST_MULTIADDR_INVALID", + 390: "STOP_RELAY_REFUSED", + 400: "MALFORMED_MESSAGE", + } + CircuitRelay_Status_value = map[string]int32{ + "SUCCESS": 100, + "HOP_SRC_ADDR_TOO_LONG": 220, + "HOP_DST_ADDR_TOO_LONG": 221, + "HOP_SRC_MULTIADDR_INVALID": 250, + "HOP_DST_MULTIADDR_INVALID": 251, + "HOP_NO_CONN_TO_DST": 260, + "HOP_CANT_DIAL_DST": 261, + "HOP_CANT_OPEN_DST_STREAM": 262, + "HOP_CANT_SPEAK_RELAY": 270, + "HOP_CANT_RELAY_TO_SELF": 280, + "STOP_SRC_ADDR_TOO_LONG": 320, + "STOP_DST_ADDR_TOO_LONG": 321, + "STOP_SRC_MULTIADDR_INVALID": 350, + "STOP_DST_MULTIADDR_INVALID": 351, + "STOP_RELAY_REFUSED": 390, + "MALFORMED_MESSAGE": 400, + } +) func (x CircuitRelay_Status) Enum() *CircuitRelay_Status { p := new(CircuitRelay_Status) @@ -89,20 +88,34 @@ func (x CircuitRelay_Status) Enum() *CircuitRelay_Status { } func (x CircuitRelay_Status) String() string { - return proto.EnumName(CircuitRelay_Status_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CircuitRelay_Status) Descriptor() protoreflect.EnumDescriptor { + return file_pb_circuitv1_proto_enumTypes[0].Descriptor() +} + +func (CircuitRelay_Status) Type() protoreflect.EnumType { + return &file_pb_circuitv1_proto_enumTypes[0] +} + +func (x CircuitRelay_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } -func (x *CircuitRelay_Status) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CircuitRelay_Status_value, data, "CircuitRelay_Status") +// Deprecated: Do not use. +func (x *CircuitRelay_Status) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = CircuitRelay_Status(value) + *x = CircuitRelay_Status(num) return nil } +// Deprecated: Use CircuitRelay_Status.Descriptor instead. func (CircuitRelay_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_129c008e7addef67, []int{0, 0} + return file_pb_circuitv1_proto_rawDescGZIP(), []int{0, 0} } type CircuitRelay_Type int32 @@ -114,19 +127,21 @@ const ( CircuitRelay_CAN_HOP CircuitRelay_Type = 4 ) -var CircuitRelay_Type_name = map[int32]string{ - 1: "HOP", - 2: "STOP", - 3: "STATUS", - 4: "CAN_HOP", -} - -var CircuitRelay_Type_value = map[string]int32{ - "HOP": 1, - "STOP": 2, - "STATUS": 3, - "CAN_HOP": 4, -} +// Enum value maps for CircuitRelay_Type. +var ( + CircuitRelay_Type_name = map[int32]string{ + 1: "HOP", + 2: "STOP", + 3: "STATUS", + 4: "CAN_HOP", + } + CircuitRelay_Type_value = map[string]int32{ + "HOP": 1, + "STOP": 2, + "STATUS": 3, + "CAN_HOP": 4, + } +) func (x CircuitRelay_Type) Enum() *CircuitRelay_Type { p := new(CircuitRelay_Type) @@ -135,734 +150,299 @@ func (x CircuitRelay_Type) Enum() *CircuitRelay_Type { } func (x CircuitRelay_Type) String() string { - return proto.EnumName(CircuitRelay_Type_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (x *CircuitRelay_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CircuitRelay_Type_value, data, "CircuitRelay_Type") +func (CircuitRelay_Type) Descriptor() protoreflect.EnumDescriptor { + return file_pb_circuitv1_proto_enumTypes[1].Descriptor() +} + +func (CircuitRelay_Type) Type() protoreflect.EnumType { + return &file_pb_circuitv1_proto_enumTypes[1] +} + +func (x CircuitRelay_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *CircuitRelay_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = CircuitRelay_Type(value) + *x = CircuitRelay_Type(num) return nil } +// Deprecated: Use CircuitRelay_Type.Descriptor instead. func (CircuitRelay_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_129c008e7addef67, []int{0, 1} + return file_pb_circuitv1_proto_rawDescGZIP(), []int{0, 1} } type CircuitRelay struct { - Type *CircuitRelay_Type `protobuf:"varint,1,opt,name=type,enum=circuitv1.pb.CircuitRelay_Type" json:"type,omitempty"` - SrcPeer *CircuitRelay_Peer `protobuf:"bytes,2,opt,name=srcPeer" json:"srcPeer,omitempty"` - DstPeer *CircuitRelay_Peer `protobuf:"bytes,3,opt,name=dstPeer" json:"dstPeer,omitempty"` - Code *CircuitRelay_Status `protobuf:"varint,4,opt,name=code,enum=circuitv1.pb.CircuitRelay_Status" json:"code,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CircuitRelay) Reset() { *m = CircuitRelay{} } -func (m *CircuitRelay) String() string { return proto.CompactTextString(m) } -func (*CircuitRelay) ProtoMessage() {} -func (*CircuitRelay) Descriptor() ([]byte, []int) { - return fileDescriptor_129c008e7addef67, []int{0} -} -func (m *CircuitRelay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CircuitRelay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CircuitRelay.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CircuitRelay) XXX_Merge(src proto.Message) { - xxx_messageInfo_CircuitRelay.Merge(m, src) -} -func (m *CircuitRelay) XXX_Size() int { - return m.Size() -} -func (m *CircuitRelay) XXX_DiscardUnknown() { - xxx_messageInfo_CircuitRelay.DiscardUnknown(m) -} - -var xxx_messageInfo_CircuitRelay proto.InternalMessageInfo + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *CircuitRelay) GetType() CircuitRelay_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return CircuitRelay_HOP + Type *CircuitRelay_Type `protobuf:"varint,1,opt,name=type,enum=circuitv1.pb.CircuitRelay_Type" json:"type,omitempty"` // Type of the message + SrcPeer *CircuitRelay_Peer `protobuf:"bytes,2,opt,name=srcPeer" json:"srcPeer,omitempty"` // srcPeer and dstPeer are used when Type is HOP or STOP + DstPeer *CircuitRelay_Peer `protobuf:"bytes,3,opt,name=dstPeer" json:"dstPeer,omitempty"` + Code *CircuitRelay_Status `protobuf:"varint,4,opt,name=code,enum=circuitv1.pb.CircuitRelay_Status" json:"code,omitempty"` // Status code, used when Type is STATUS } -func (m *CircuitRelay) GetSrcPeer() *CircuitRelay_Peer { - if m != nil { - return m.SrcPeer +func (x *CircuitRelay) Reset() { + *x = CircuitRelay{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_circuitv1_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -func (m *CircuitRelay) GetDstPeer() *CircuitRelay_Peer { - if m != nil { - return m.DstPeer - } - return nil +func (x *CircuitRelay) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CircuitRelay) GetCode() CircuitRelay_Status { - if m != nil && m.Code != nil { - return *m.Code +func (*CircuitRelay) ProtoMessage() {} + +func (x *CircuitRelay) ProtoReflect() protoreflect.Message { + mi := &file_pb_circuitv1_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return CircuitRelay_SUCCESS + return mi.MessageOf(x) } -type CircuitRelay_Peer struct { - Id []byte `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` - Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use CircuitRelay.ProtoReflect.Descriptor instead. +func (*CircuitRelay) Descriptor() ([]byte, []int) { + return file_pb_circuitv1_proto_rawDescGZIP(), []int{0} } -func (m *CircuitRelay_Peer) Reset() { *m = CircuitRelay_Peer{} } -func (m *CircuitRelay_Peer) String() string { return proto.CompactTextString(m) } -func (*CircuitRelay_Peer) ProtoMessage() {} -func (*CircuitRelay_Peer) Descriptor() ([]byte, []int) { - return fileDescriptor_129c008e7addef67, []int{0, 0} -} -func (m *CircuitRelay_Peer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CircuitRelay_Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CircuitRelay_Peer.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *CircuitRelay) GetType() CircuitRelay_Type { + if x != nil && x.Type != nil { + return *x.Type } -} -func (m *CircuitRelay_Peer) XXX_Merge(src proto.Message) { - xxx_messageInfo_CircuitRelay_Peer.Merge(m, src) -} -func (m *CircuitRelay_Peer) XXX_Size() int { - return m.Size() -} -func (m *CircuitRelay_Peer) XXX_DiscardUnknown() { - xxx_messageInfo_CircuitRelay_Peer.DiscardUnknown(m) + return CircuitRelay_HOP } -var xxx_messageInfo_CircuitRelay_Peer proto.InternalMessageInfo - -func (m *CircuitRelay_Peer) GetId() []byte { - if m != nil { - return m.Id +func (x *CircuitRelay) GetSrcPeer() *CircuitRelay_Peer { + if x != nil { + return x.SrcPeer } return nil } -func (m *CircuitRelay_Peer) GetAddrs() [][]byte { - if m != nil { - return m.Addrs +func (x *CircuitRelay) GetDstPeer() *CircuitRelay_Peer { + if x != nil { + return x.DstPeer } return nil } -func init() { - proto.RegisterEnum("circuitv1.pb.CircuitRelay_Status", CircuitRelay_Status_name, CircuitRelay_Status_value) - proto.RegisterEnum("circuitv1.pb.CircuitRelay_Type", CircuitRelay_Type_name, CircuitRelay_Type_value) - proto.RegisterType((*CircuitRelay)(nil), "circuitv1.pb.CircuitRelay") - proto.RegisterType((*CircuitRelay_Peer)(nil), "circuitv1.pb.CircuitRelay.Peer") -} - -func init() { proto.RegisterFile("circuitv1.proto", fileDescriptor_129c008e7addef67) } - -var fileDescriptor_129c008e7addef67 = []byte{ - // 475 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4d, 0x6f, 0xd3, 0x30, - 0x18, 0x80, 0x65, 0x27, 0xb4, 0xe8, 0x5d, 0x35, 0x8c, 0x35, 0x46, 0x56, 0x44, 0x57, 0x7a, 0xea, - 0x01, 0x55, 0x62, 0x88, 0x03, 0x47, 0x93, 0xb8, 0x5b, 0x45, 0x1a, 0x57, 0xb6, 0x8b, 0xc4, 0xc9, - 0x2a, 0x4d, 0x0e, 0x95, 0x90, 0x5a, 0xa5, 0x19, 0x52, 0xef, 0xb0, 0x23, 0xe2, 0x06, 0x3f, 0x07, - 0x38, 0x71, 0xe4, 0x07, 0xf0, 0xa5, 0xfe, 0x0c, 0xb8, 0x20, 0xbb, 0x34, 0xab, 0xe8, 0x34, 0xed, - 0xd8, 0xf7, 0x79, 0x1e, 0xd7, 0x79, 0x13, 0xb8, 0x31, 0x9e, 0xe4, 0xe3, 0xd3, 0x49, 0xf1, 0xea, - 0x41, 0x67, 0x96, 0x4f, 0x8b, 0x29, 0xad, 0x6d, 0x0c, 0x5e, 0xb4, 0xde, 0x57, 0xa0, 0x16, 0xae, - 0x06, 0x32, 0x7b, 0x39, 0x5a, 0xd0, 0x87, 0xe0, 0x17, 0x8b, 0x59, 0x16, 0xa0, 0x26, 0x6a, 0xef, - 0x1e, 0x1d, 0x76, 0x36, 0xed, 0xce, 0xa6, 0xd9, 0xd1, 0x8b, 0x59, 0x26, 0x9d, 0x4c, 0x1f, 0x43, - 0x75, 0x9e, 0x8f, 0x07, 0x59, 0x96, 0x07, 0xb8, 0x89, 0xda, 0x3b, 0x97, 0x76, 0x56, 0x93, 0x6b, - 0xdf, 0xa6, 0xe9, 0xbc, 0x70, 0xa9, 0x77, 0xc5, 0xf4, 0x9f, 0x4f, 0x1f, 0x81, 0x3f, 0x9e, 0xa6, - 0x59, 0xe0, 0xbb, 0xab, 0xde, 0xbb, 0xa4, 0x53, 0xc5, 0xa8, 0x38, 0x9d, 0x4b, 0xa7, 0xd7, 0xef, - 0x83, 0xef, 0xf2, 0x5d, 0xc0, 0x93, 0x34, 0x40, 0x4d, 0xdc, 0xae, 0x49, 0x3c, 0x49, 0xe9, 0x1e, - 0x5c, 0x1b, 0xa5, 0x69, 0x3e, 0x0f, 0x70, 0xd3, 0x6b, 0xd7, 0xe4, 0xea, 0x47, 0xeb, 0xb3, 0x07, - 0x95, 0x55, 0x4e, 0x77, 0xa0, 0xaa, 0x86, 0x61, 0xc8, 0x95, 0x22, 0x29, 0xad, 0xc3, 0xad, 0x13, - 0x31, 0x30, 0x4a, 0x86, 0x86, 0x45, 0x91, 0x34, 0x5a, 0x08, 0x13, 0x8b, 0xe4, 0x98, 0x7c, 0x43, - 0x6b, 0x16, 0x29, 0xfd, 0x1f, 0xfb, 0x8e, 0x68, 0x03, 0x0e, 0xd6, 0x5d, 0x7f, 0x18, 0xeb, 0x9e, - 0x13, 0x7a, 0xc9, 0x33, 0x16, 0xf7, 0x22, 0xf2, 0xbb, 0xe4, 0xb6, 0xdd, 0xe6, 0x7f, 0x10, 0xbd, - 0x0d, 0xd4, 0xf2, 0x44, 0x98, 0x50, 0x24, 0x89, 0xd1, 0xc2, 0xaa, 0xe4, 0x35, 0xa6, 0xfb, 0x70, - 0xd3, 0x82, 0x90, 0x25, 0xda, 0x44, 0x3d, 0x16, 0xbb, 0xf9, 0x1b, 0x4c, 0xef, 0x42, 0x50, 0xce, - 0xc5, 0x80, 0x27, 0xee, 0x68, 0xa5, 0x25, 0x67, 0x7d, 0x72, 0x86, 0xe9, 0x01, 0xec, 0x95, 0x58, - 0x0d, 0x38, 0x7b, 0x6a, 0x24, 0x8f, 0xd9, 0x73, 0xf2, 0x16, 0xd3, 0x3b, 0xb0, 0x5f, 0x22, 0x37, - 0xb4, 0xff, 0xa6, 0x78, 0xdc, 0x25, 0x1f, 0x1c, 0x54, 0xfa, 0xc2, 0x05, 0x7c, 0x3c, 0x87, 0xdb, - 0x1b, 0xf8, 0x84, 0xe9, 0x21, 0xd4, 0xcb, 0x72, 0xfb, 0x11, 0x7f, 0x9c, 0x0b, 0x17, 0xef, 0xe0, - 0x27, 0xb6, 0x3b, 0x70, 0xc2, 0xea, 0x52, 0x92, 0x77, 0x87, 0x8a, 0x47, 0xe4, 0xcc, 0xb3, 0x3b, - 0xe8, 0xb3, 0xb8, 0x2b, 0x64, 0x9f, 0x47, 0xa6, 0xcf, 0x95, 0x62, 0xc7, 0x9c, 0xbc, 0xf3, 0x5a, - 0x47, 0xe0, 0xdb, 0xaf, 0x95, 0x56, 0xc1, 0x3b, 0x11, 0x03, 0x82, 0xe8, 0x75, 0xf0, 0xed, 0x09, - 0x04, 0x53, 0x80, 0x8a, 0xd2, 0x4c, 0x0f, 0x15, 0xf1, 0xec, 0x0b, 0x0e, 0x59, 0x62, 0xac, 0xe2, - 0x3f, 0xa9, 0x7d, 0x59, 0x36, 0xd0, 0xd7, 0x65, 0x03, 0xfd, 0x5a, 0x36, 0xd0, 0xdf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x52, 0xcc, 0x98, 0x82, 0x47, 0x03, 0x00, 0x00, -} - -func (m *CircuitRelay) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *CircuitRelay) GetCode() CircuitRelay_Status { + if x != nil && x.Code != nil { + return *x.Code } - return dAtA[:n], nil + return CircuitRelay_SUCCESS } -func (m *CircuitRelay) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +type CircuitRelay_Peer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *CircuitRelay) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Code != nil { - i = encodeVarintCircuitv1(dAtA, i, uint64(*m.Code)) - i-- - dAtA[i] = 0x20 - } - if m.DstPeer != nil { - { - size, err := m.DstPeer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCircuitv1(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.SrcPeer != nil { - { - size, err := m.SrcPeer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCircuitv1(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Type != nil { - i = encodeVarintCircuitv1(dAtA, i, uint64(*m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil + Id []byte `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` // peer id + Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` // peer's known addresses } -func (m *CircuitRelay_Peer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *CircuitRelay_Peer) Reset() { + *x = CircuitRelay_Peer{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_circuitv1_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return dAtA[:n], nil } -func (m *CircuitRelay_Peer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *CircuitRelay_Peer) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CircuitRelay_Peer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Addrs) > 0 { - for iNdEx := len(m.Addrs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addrs[iNdEx]) - copy(dAtA[i:], m.Addrs[iNdEx]) - i = encodeVarintCircuitv1(dAtA, i, uint64(len(m.Addrs[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Id == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") - } else { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintCircuitv1(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintCircuitv1(dAtA []byte, offset int, v uint64) int { - offset -= sovCircuitv1(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *CircuitRelay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != nil { - n += 1 + sovCircuitv1(uint64(*m.Type)) - } - if m.SrcPeer != nil { - l = m.SrcPeer.Size() - n += 1 + l + sovCircuitv1(uint64(l)) - } - if m.DstPeer != nil { - l = m.DstPeer.Size() - n += 1 + l + sovCircuitv1(uint64(l)) - } - if m.Code != nil { - n += 1 + sovCircuitv1(uint64(*m.Code)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} +func (*CircuitRelay_Peer) ProtoMessage() {} -func (m *CircuitRelay_Peer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != nil { - l = len(m.Id) - n += 1 + l + sovCircuitv1(uint64(l)) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - l = len(b) - n += 1 + l + sovCircuitv1(uint64(l)) +func (x *CircuitRelay_Peer) ProtoReflect() protoreflect.Message { + mi := &file_pb_circuitv1_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return mi.MessageOf(x) } -func sovCircuitv1(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCircuitv1(x uint64) (n int) { - return sovCircuitv1(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +// Deprecated: Use CircuitRelay_Peer.ProtoReflect.Descriptor instead. +func (*CircuitRelay_Peer) Descriptor() ([]byte, []int) { + return file_pb_circuitv1_proto_rawDescGZIP(), []int{0, 0} } -func (m *CircuitRelay) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CircuitRelay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CircuitRelay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var v CircuitRelay_Type - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= CircuitRelay_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Type = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcPeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCircuitv1 - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCircuitv1 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SrcPeer == nil { - m.SrcPeer = &CircuitRelay_Peer{} - } - if err := m.SrcPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DstPeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCircuitv1 - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCircuitv1 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DstPeer == nil { - m.DstPeer = &CircuitRelay_Peer{} - } - if err := m.DstPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) - } - var v CircuitRelay_Status - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= CircuitRelay_Status(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Code = &v - default: - iNdEx = preIndex - skippy, err := skipCircuitv1(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCircuitv1 - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCircuitv1 - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *CircuitRelay_Peer) GetId() []byte { + if x != nil { + return x.Id } return nil } -func (m *CircuitRelay_Peer) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Peer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Peer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCircuitv1 - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCircuitv1 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCircuitv1 - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCircuitv1 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, make([]byte, postIndex-iNdEx)) - copy(m.Addrs[len(m.Addrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCircuitv1(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCircuitv1 - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCircuitv1 - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *CircuitRelay_Peer) GetAddrs() [][]byte { + if x != nil { + return x.Addrs } return nil } -func skipCircuitv1(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 { - if shift >= 64 { - return 0, ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + +var File_pb_circuitv1_proto protoreflect.FileDescriptor + +var file_pb_circuitv1_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x62, 0x2f, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x76, 0x31, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x76, 0x31, 0x2e, + 0x70, 0x62, 0x22, 0x97, 0x06, 0x0a, 0x0c, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x76, 0x31, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x72, 0x63, 0x50, + 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x69, 0x72, 0x63, + 0x75, 0x69, 0x74, 0x76, 0x31, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x07, 0x73, 0x72, 0x63, 0x50, + 0x65, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x76, 0x31, + 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x07, 0x64, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, 0x35, + 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x63, + 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x76, 0x31, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x69, 0x72, 0x63, + 0x75, 0x69, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x1a, 0x2c, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, + 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x05, 0x61, 0x64, + 0x64, 0x72, 0x73, 0x22, 0xc2, 0x03, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, + 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x64, 0x12, 0x1a, 0x0a, 0x15, 0x48, + 0x4f, 0x50, 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x54, 0x4f, 0x4f, 0x5f, + 0x4c, 0x4f, 0x4e, 0x47, 0x10, 0xdc, 0x01, 0x12, 0x1a, 0x0a, 0x15, 0x48, 0x4f, 0x50, 0x5f, 0x44, + 0x53, 0x54, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x54, 0x4f, 0x4f, 0x5f, 0x4c, 0x4f, 0x4e, 0x47, + 0x10, 0xdd, 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x48, 0x4f, 0x50, 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x4d, + 0x55, 0x4c, 0x54, 0x49, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, + 0x10, 0xfa, 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x48, 0x4f, 0x50, 0x5f, 0x44, 0x53, 0x54, 0x5f, 0x4d, + 0x55, 0x4c, 0x54, 0x49, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, + 0x10, 0xfb, 0x01, 0x12, 0x17, 0x0a, 0x12, 0x48, 0x4f, 0x50, 0x5f, 0x4e, 0x4f, 0x5f, 0x43, 0x4f, + 0x4e, 0x4e, 0x5f, 0x54, 0x4f, 0x5f, 0x44, 0x53, 0x54, 0x10, 0x84, 0x02, 0x12, 0x16, 0x0a, 0x11, + 0x48, 0x4f, 0x50, 0x5f, 0x43, 0x41, 0x4e, 0x54, 0x5f, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x44, 0x53, + 0x54, 0x10, 0x85, 0x02, 0x12, 0x1d, 0x0a, 0x18, 0x48, 0x4f, 0x50, 0x5f, 0x43, 0x41, 0x4e, 0x54, + 0x5f, 0x4f, 0x50, 0x45, 0x4e, 0x5f, 0x44, 0x53, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4d, + 0x10, 0x86, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x4f, 0x50, 0x5f, 0x43, 0x41, 0x4e, 0x54, 0x5f, + 0x53, 0x50, 0x45, 0x41, 0x4b, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x59, 0x10, 0x8e, 0x02, 0x12, 0x1b, + 0x0a, 0x16, 0x48, 0x4f, 0x50, 0x5f, 0x43, 0x41, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x59, + 0x5f, 0x54, 0x4f, 0x5f, 0x53, 0x45, 0x4c, 0x46, 0x10, 0x98, 0x02, 0x12, 0x1b, 0x0a, 0x16, 0x53, + 0x54, 0x4f, 0x50, 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x54, 0x4f, 0x4f, + 0x5f, 0x4c, 0x4f, 0x4e, 0x47, 0x10, 0xc0, 0x02, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x54, 0x4f, 0x50, + 0x5f, 0x44, 0x53, 0x54, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x54, 0x4f, 0x4f, 0x5f, 0x4c, 0x4f, + 0x4e, 0x47, 0x10, 0xc1, 0x02, 0x12, 0x1f, 0x0a, 0x1a, 0x53, 0x54, 0x4f, 0x50, 0x5f, 0x53, 0x52, + 0x43, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x49, 0x4e, 0x56, 0x41, + 0x4c, 0x49, 0x44, 0x10, 0xde, 0x02, 0x12, 0x1f, 0x0a, 0x1a, 0x53, 0x54, 0x4f, 0x50, 0x5f, 0x44, + 0x53, 0x54, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x49, 0x4e, 0x56, + 0x41, 0x4c, 0x49, 0x44, 0x10, 0xdf, 0x02, 0x12, 0x17, 0x0a, 0x12, 0x53, 0x54, 0x4f, 0x50, 0x5f, + 0x52, 0x45, 0x4c, 0x41, 0x59, 0x5f, 0x52, 0x45, 0x46, 0x55, 0x53, 0x45, 0x44, 0x10, 0x86, 0x03, + 0x12, 0x16, 0x0a, 0x11, 0x4d, 0x41, 0x4c, 0x46, 0x4f, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x4d, 0x45, + 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x90, 0x03, 0x22, 0x32, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x07, 0x0a, 0x03, 0x48, 0x4f, 0x50, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54, 0x4f, + 0x50, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x03, 0x12, + 0x0b, 0x0a, 0x07, 0x43, 0x41, 0x4e, 0x5f, 0x48, 0x4f, 0x50, 0x10, 0x04, +} + +var ( + file_pb_circuitv1_proto_rawDescOnce sync.Once + file_pb_circuitv1_proto_rawDescData = file_pb_circuitv1_proto_rawDesc +) + +func file_pb_circuitv1_proto_rawDescGZIP() []byte { + file_pb_circuitv1_proto_rawDescOnce.Do(func() { + file_pb_circuitv1_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_circuitv1_proto_rawDescData) + }) + return file_pb_circuitv1_proto_rawDescData +} + +var file_pb_circuitv1_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_pb_circuitv1_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_pb_circuitv1_proto_goTypes = []interface{}{ + (CircuitRelay_Status)(0), // 0: circuitv1.pb.CircuitRelay.Status + (CircuitRelay_Type)(0), // 1: circuitv1.pb.CircuitRelay.Type + (*CircuitRelay)(nil), // 2: circuitv1.pb.CircuitRelay + (*CircuitRelay_Peer)(nil), // 3: circuitv1.pb.CircuitRelay.Peer +} +var file_pb_circuitv1_proto_depIdxs = []int32{ + 1, // 0: circuitv1.pb.CircuitRelay.type:type_name -> circuitv1.pb.CircuitRelay.Type + 3, // 1: circuitv1.pb.CircuitRelay.srcPeer:type_name -> circuitv1.pb.CircuitRelay.Peer + 3, // 2: circuitv1.pb.CircuitRelay.dstPeer:type_name -> circuitv1.pb.CircuitRelay.Peer + 0, // 3: circuitv1.pb.CircuitRelay.code:type_name -> circuitv1.pb.CircuitRelay.Status + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_pb_circuitv1_proto_init() } +func file_pb_circuitv1_proto_init() { + if File_pb_circuitv1_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_circuitv1_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CircuitRelay); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCircuitv1 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthCircuitv1 + file_pb_circuitv1_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CircuitRelay_Peer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCircuitv1 - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCircuitv1 - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_circuitv1_proto_rawDesc, + NumEnums: 2, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_circuitv1_proto_goTypes, + DependencyIndexes: file_pb_circuitv1_proto_depIdxs, + EnumInfos: file_pb_circuitv1_proto_enumTypes, + MessageInfos: file_pb_circuitv1_proto_msgTypes, + }.Build() + File_pb_circuitv1_proto = out.File + file_pb_circuitv1_proto_rawDesc = nil + file_pb_circuitv1_proto_goTypes = nil + file_pb_circuitv1_proto_depIdxs = nil } - -var ( - ErrInvalidLengthCircuitv1 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCircuitv1 = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCircuitv1 = fmt.Errorf("proto: unexpected end of group") -) diff --git a/p2p/protocol/circuitv1/proto.go b/p2p/protocol/circuitv1/proto.go new file mode 100644 index 0000000000..9d2f0b2a69 --- /dev/null +++ b/p2p/protocol/circuitv1/proto.go @@ -0,0 +1,3 @@ +package circuitv1 + +//go:generate protoc --proto_path=$PWD:$PWD/../../.. --go_out=. --go_opt=Mpb/circuitv1.proto=./pb pb/circuitv1.proto diff --git a/p2p/protocol/circuitv2/pb/Makefile b/p2p/protocol/circuitv2/pb/Makefile deleted file mode 100644 index c360a6fb95..0000000000 --- a/p2p/protocol/circuitv2/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/p2p/protocol/circuitv2/pb/circuit.pb.go b/p2p/protocol/circuitv2/pb/circuit.pb.go index 9cbff1ac08..3e1bebdf34 100644 --- a/p2p/protocol/circuitv2/pb/circuit.pb.go +++ b/p2p/protocol/circuitv2/pb/circuit.pb.go @@ -1,27 +1,24 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: circuit.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/circuit.proto -package circuit_pb +package pb import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Status int32 @@ -36,27 +33,29 @@ const ( Status_UNEXPECTED_MESSAGE Status = 401 ) -var Status_name = map[int32]string{ - 100: "OK", - 200: "RESERVATION_REFUSED", - 201: "RESOURCE_LIMIT_EXCEEDED", - 202: "PERMISSION_DENIED", - 203: "CONNECTION_FAILED", - 204: "NO_RESERVATION", - 400: "MALFORMED_MESSAGE", - 401: "UNEXPECTED_MESSAGE", -} - -var Status_value = map[string]int32{ - "OK": 100, - "RESERVATION_REFUSED": 200, - "RESOURCE_LIMIT_EXCEEDED": 201, - "PERMISSION_DENIED": 202, - "CONNECTION_FAILED": 203, - "NO_RESERVATION": 204, - "MALFORMED_MESSAGE": 400, - "UNEXPECTED_MESSAGE": 401, -} +// Enum value maps for Status. +var ( + Status_name = map[int32]string{ + 100: "OK", + 200: "RESERVATION_REFUSED", + 201: "RESOURCE_LIMIT_EXCEEDED", + 202: "PERMISSION_DENIED", + 203: "CONNECTION_FAILED", + 204: "NO_RESERVATION", + 400: "MALFORMED_MESSAGE", + 401: "UNEXPECTED_MESSAGE", + } + Status_value = map[string]int32{ + "OK": 100, + "RESERVATION_REFUSED": 200, + "RESOURCE_LIMIT_EXCEEDED": 201, + "PERMISSION_DENIED": 202, + "CONNECTION_FAILED": 203, + "NO_RESERVATION": 204, + "MALFORMED_MESSAGE": 400, + "UNEXPECTED_MESSAGE": 401, + } +) func (x Status) Enum() *Status { p := new(Status) @@ -65,20 +64,34 @@ func (x Status) Enum() *Status { } func (x Status) String() string { - return proto.EnumName(Status_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Status) Descriptor() protoreflect.EnumDescriptor { + return file_pb_circuit_proto_enumTypes[0].Descriptor() } -func (x *Status) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Status_value, data, "Status") +func (Status) Type() protoreflect.EnumType { + return &file_pb_circuit_proto_enumTypes[0] +} + +func (x Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Status) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = Status(value) + *x = Status(num) return nil } +// Deprecated: Use Status.Descriptor instead. func (Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ed01bbc211f15e47, []int{0} + return file_pb_circuit_proto_rawDescGZIP(), []int{0} } type HopMessage_Type int32 @@ -89,17 +102,19 @@ const ( HopMessage_STATUS HopMessage_Type = 2 ) -var HopMessage_Type_name = map[int32]string{ - 0: "RESERVE", - 1: "CONNECT", - 2: "STATUS", -} - -var HopMessage_Type_value = map[string]int32{ - "RESERVE": 0, - "CONNECT": 1, - "STATUS": 2, -} +// Enum value maps for HopMessage_Type. +var ( + HopMessage_Type_name = map[int32]string{ + 0: "RESERVE", + 1: "CONNECT", + 2: "STATUS", + } + HopMessage_Type_value = map[string]int32{ + "RESERVE": 0, + "CONNECT": 1, + "STATUS": 2, + } +) func (x HopMessage_Type) Enum() *HopMessage_Type { p := new(HopMessage_Type) @@ -108,20 +123,34 @@ func (x HopMessage_Type) Enum() *HopMessage_Type { } func (x HopMessage_Type) String() string { - return proto.EnumName(HopMessage_Type_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (x *HopMessage_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(HopMessage_Type_value, data, "HopMessage_Type") +func (HopMessage_Type) Descriptor() protoreflect.EnumDescriptor { + return file_pb_circuit_proto_enumTypes[1].Descriptor() +} + +func (HopMessage_Type) Type() protoreflect.EnumType { + return &file_pb_circuit_proto_enumTypes[1] +} + +func (x HopMessage_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *HopMessage_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = HopMessage_Type(value) + *x = HopMessage_Type(num) return nil } +// Deprecated: Use HopMessage_Type.Descriptor instead. func (HopMessage_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ed01bbc211f15e47, []int{0, 0} + return file_pb_circuit_proto_rawDescGZIP(), []int{0, 0} } type StopMessage_Type int32 @@ -131,15 +160,17 @@ const ( StopMessage_STATUS StopMessage_Type = 1 ) -var StopMessage_Type_name = map[int32]string{ - 0: "CONNECT", - 1: "STATUS", -} - -var StopMessage_Type_value = map[string]int32{ - "CONNECT": 0, - "STATUS": 1, -} +// Enum value maps for StopMessage_Type. +var ( + StopMessage_Type_name = map[int32]string{ + 0: "CONNECT", + 1: "STATUS", + } + StopMessage_Type_value = map[string]int32{ + "CONNECT": 0, + "STATUS": 1, + } +) func (x StopMessage_Type) Enum() *StopMessage_Type { p := new(StopMessage_Type) @@ -148,1611 +179,547 @@ func (x StopMessage_Type) Enum() *StopMessage_Type { } func (x StopMessage_Type) String() string { - return proto.EnumName(StopMessage_Type_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StopMessage_Type) Descriptor() protoreflect.EnumDescriptor { + return file_pb_circuit_proto_enumTypes[2].Descriptor() +} + +func (StopMessage_Type) Type() protoreflect.EnumType { + return &file_pb_circuit_proto_enumTypes[2] +} + +func (x StopMessage_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } -func (x *StopMessage_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(StopMessage_Type_value, data, "StopMessage_Type") +// Deprecated: Do not use. +func (x *StopMessage_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = StopMessage_Type(value) + *x = StopMessage_Type(num) return nil } +// Deprecated: Use StopMessage_Type.Descriptor instead. func (StopMessage_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ed01bbc211f15e47, []int{1, 0} + return file_pb_circuit_proto_rawDescGZIP(), []int{1, 0} } type HopMessage struct { - Type *HopMessage_Type `protobuf:"varint,1,req,name=type,enum=circuit.pb.HopMessage_Type" json:"type,omitempty"` - Peer *Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` - Reservation *Reservation `protobuf:"bytes,3,opt,name=reservation" json:"reservation,omitempty"` - Limit *Limit `protobuf:"bytes,4,opt,name=limit" json:"limit,omitempty"` - Status *Status `protobuf:"varint,5,opt,name=status,enum=circuit.pb.Status" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HopMessage) Reset() { *m = HopMessage{} } -func (m *HopMessage) String() string { return proto.CompactTextString(m) } -func (*HopMessage) ProtoMessage() {} -func (*HopMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed01bbc211f15e47, []int{0} -} -func (m *HopMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HopMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HopMessage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HopMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_HopMessage.Merge(m, src) -} -func (m *HopMessage) XXX_Size() int { - return m.Size() -} -func (m *HopMessage) XXX_DiscardUnknown() { - xxx_messageInfo_HopMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_HopMessage proto.InternalMessageInfo + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *HopMessage) GetType() HopMessage_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return HopMessage_RESERVE + Type *HopMessage_Type `protobuf:"varint,1,req,name=type,enum=circuit.pb.HopMessage_Type" json:"type,omitempty"` + Peer *Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` + Reservation *Reservation `protobuf:"bytes,3,opt,name=reservation" json:"reservation,omitempty"` + Limit *Limit `protobuf:"bytes,4,opt,name=limit" json:"limit,omitempty"` + Status *Status `protobuf:"varint,5,opt,name=status,enum=circuit.pb.Status" json:"status,omitempty"` } -func (m *HopMessage) GetPeer() *Peer { - if m != nil { - return m.Peer +func (x *HopMessage) Reset() { + *x = HopMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_circuit_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -func (m *HopMessage) GetReservation() *Reservation { - if m != nil { - return m.Reservation - } - return nil +func (x *HopMessage) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HopMessage) GetLimit() *Limit { - if m != nil { - return m.Limit +func (*HopMessage) ProtoMessage() {} + +func (x *HopMessage) ProtoReflect() protoreflect.Message { + mi := &file_pb_circuit_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (m *HopMessage) GetStatus() Status { - if m != nil && m.Status != nil { - return *m.Status - } - return Status_OK +// Deprecated: Use HopMessage.ProtoReflect.Descriptor instead. +func (*HopMessage) Descriptor() ([]byte, []int) { + return file_pb_circuit_proto_rawDescGZIP(), []int{0} } -type StopMessage struct { - Type *StopMessage_Type `protobuf:"varint,1,req,name=type,enum=circuit.pb.StopMessage_Type" json:"type,omitempty"` - Peer *Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` - Limit *Limit `protobuf:"bytes,3,opt,name=limit" json:"limit,omitempty"` - Status *Status `protobuf:"varint,4,opt,name=status,enum=circuit.pb.Status" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StopMessage) Reset() { *m = StopMessage{} } -func (m *StopMessage) String() string { return proto.CompactTextString(m) } -func (*StopMessage) ProtoMessage() {} -func (*StopMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed01bbc211f15e47, []int{1} -} -func (m *StopMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StopMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StopMessage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *HopMessage) GetType() HopMessage_Type { + if x != nil && x.Type != nil { + return *x.Type } + return HopMessage_RESERVE } -func (m *StopMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_StopMessage.Merge(m, src) -} -func (m *StopMessage) XXX_Size() int { - return m.Size() -} -func (m *StopMessage) XXX_DiscardUnknown() { - xxx_messageInfo_StopMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_StopMessage proto.InternalMessageInfo -func (m *StopMessage) GetType() StopMessage_Type { - if m != nil && m.Type != nil { - return *m.Type +func (x *HopMessage) GetPeer() *Peer { + if x != nil { + return x.Peer } - return StopMessage_CONNECT + return nil } -func (m *StopMessage) GetPeer() *Peer { - if m != nil { - return m.Peer +func (x *HopMessage) GetReservation() *Reservation { + if x != nil { + return x.Reservation } return nil } -func (m *StopMessage) GetLimit() *Limit { - if m != nil { - return m.Limit +func (x *HopMessage) GetLimit() *Limit { + if x != nil { + return x.Limit } return nil } -func (m *StopMessage) GetStatus() Status { - if m != nil && m.Status != nil { - return *m.Status +func (x *HopMessage) GetStatus() Status { + if x != nil && x.Status != nil { + return *x.Status } return Status_OK } -type Peer struct { - Id []byte `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` - Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +type StopMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Peer) Reset() { *m = Peer{} } -func (m *Peer) String() string { return proto.CompactTextString(m) } -func (*Peer) ProtoMessage() {} -func (*Peer) Descriptor() ([]byte, []int) { - return fileDescriptor_ed01bbc211f15e47, []int{2} -} -func (m *Peer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Peer.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Peer) XXX_Merge(src proto.Message) { - xxx_messageInfo_Peer.Merge(m, src) -} -func (m *Peer) XXX_Size() int { - return m.Size() -} -func (m *Peer) XXX_DiscardUnknown() { - xxx_messageInfo_Peer.DiscardUnknown(m) + Type *StopMessage_Type `protobuf:"varint,1,req,name=type,enum=circuit.pb.StopMessage_Type" json:"type,omitempty"` + Peer *Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` + Limit *Limit `protobuf:"bytes,3,opt,name=limit" json:"limit,omitempty"` + Status *Status `protobuf:"varint,4,opt,name=status,enum=circuit.pb.Status" json:"status,omitempty"` } -var xxx_messageInfo_Peer proto.InternalMessageInfo - -func (m *Peer) GetId() []byte { - if m != nil { - return m.Id +func (x *StopMessage) Reset() { + *x = StopMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_circuit_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -func (m *Peer) GetAddrs() [][]byte { - if m != nil { - return m.Addrs - } - return nil +func (x *StopMessage) String() string { + return protoimpl.X.MessageStringOf(x) } -type Reservation struct { - Expire *uint64 `protobuf:"varint,1,req,name=expire" json:"expire,omitempty"` - Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` - Voucher []byte `protobuf:"bytes,3,opt,name=voucher" json:"voucher,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +func (*StopMessage) ProtoMessage() {} -func (m *Reservation) Reset() { *m = Reservation{} } -func (m *Reservation) String() string { return proto.CompactTextString(m) } -func (*Reservation) ProtoMessage() {} -func (*Reservation) Descriptor() ([]byte, []int) { - return fileDescriptor_ed01bbc211f15e47, []int{3} -} -func (m *Reservation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Reservation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Reservation.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *StopMessage) ProtoReflect() protoreflect.Message { + mi := &file_pb_circuit_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Reservation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Reservation.Merge(m, src) -} -func (m *Reservation) XXX_Size() int { - return m.Size() -} -func (m *Reservation) XXX_DiscardUnknown() { - xxx_messageInfo_Reservation.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Reservation proto.InternalMessageInfo +// Deprecated: Use StopMessage.ProtoReflect.Descriptor instead. +func (*StopMessage) Descriptor() ([]byte, []int) { + return file_pb_circuit_proto_rawDescGZIP(), []int{1} +} -func (m *Reservation) GetExpire() uint64 { - if m != nil && m.Expire != nil { - return *m.Expire +func (x *StopMessage) GetType() StopMessage_Type { + if x != nil && x.Type != nil { + return *x.Type } - return 0 + return StopMessage_CONNECT } -func (m *Reservation) GetAddrs() [][]byte { - if m != nil { - return m.Addrs +func (x *StopMessage) GetPeer() *Peer { + if x != nil { + return x.Peer } return nil } -func (m *Reservation) GetVoucher() []byte { - if m != nil { - return m.Voucher +func (x *StopMessage) GetLimit() *Limit { + if x != nil { + return x.Limit } return nil } -type Limit struct { - Duration *uint32 `protobuf:"varint,1,opt,name=duration" json:"duration,omitempty"` - Data *uint64 `protobuf:"varint,2,opt,name=data" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Limit) Reset() { *m = Limit{} } -func (m *Limit) String() string { return proto.CompactTextString(m) } -func (*Limit) ProtoMessage() {} -func (*Limit) Descriptor() ([]byte, []int) { - return fileDescriptor_ed01bbc211f15e47, []int{4} -} -func (m *Limit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Limit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Limit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *StopMessage) GetStatus() Status { + if x != nil && x.Status != nil { + return *x.Status } -} -func (m *Limit) XXX_Merge(src proto.Message) { - xxx_messageInfo_Limit.Merge(m, src) -} -func (m *Limit) XXX_Size() int { - return m.Size() -} -func (m *Limit) XXX_DiscardUnknown() { - xxx_messageInfo_Limit.DiscardUnknown(m) + return Status_OK } -var xxx_messageInfo_Limit proto.InternalMessageInfo +type Peer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Limit) GetDuration() uint32 { - if m != nil && m.Duration != nil { - return *m.Duration - } - return 0 + Id []byte `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` + Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` } -func (m *Limit) GetData() uint64 { - if m != nil && m.Data != nil { - return *m.Data +func (x *Peer) Reset() { + *x = Peer{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_circuit_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -func init() { - proto.RegisterEnum("circuit.pb.Status", Status_name, Status_value) - proto.RegisterEnum("circuit.pb.HopMessage_Type", HopMessage_Type_name, HopMessage_Type_value) - proto.RegisterEnum("circuit.pb.StopMessage_Type", StopMessage_Type_name, StopMessage_Type_value) - proto.RegisterType((*HopMessage)(nil), "circuit.pb.HopMessage") - proto.RegisterType((*StopMessage)(nil), "circuit.pb.StopMessage") - proto.RegisterType((*Peer)(nil), "circuit.pb.Peer") - proto.RegisterType((*Reservation)(nil), "circuit.pb.Reservation") - proto.RegisterType((*Limit)(nil), "circuit.pb.Limit") -} - -func init() { proto.RegisterFile("circuit.proto", fileDescriptor_ed01bbc211f15e47) } - -var fileDescriptor_ed01bbc211f15e47 = []byte{ - // 514 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0xcf, 0x8a, 0xd3, 0x50, - 0x18, 0xc5, 0xe7, 0xa6, 0x69, 0x47, 0xbe, 0x76, 0x4a, 0xe6, 0x1b, 0x99, 0x06, 0x1d, 0x6a, 0x29, - 0x82, 0x65, 0x90, 0x2a, 0xdd, 0x88, 0xcb, 0xda, 0x7c, 0xd5, 0x60, 0x93, 0x94, 0x7b, 0x53, 0x99, - 0x5d, 0x89, 0xcd, 0x45, 0x03, 0x6a, 0x43, 0x92, 0x0e, 0xce, 0x5b, 0xe8, 0x23, 0xf8, 0x22, 0xae, - 0xc7, 0x3f, 0x0b, 0xf7, 0x6e, 0xa4, 0x4f, 0x22, 0xb9, 0xe9, 0xb4, 0x19, 0x10, 0x14, 0xdc, 0xf5, - 0xdc, 0x73, 0x0e, 0xb7, 0xbf, 0x73, 0x03, 0x07, 0x8b, 0x28, 0x59, 0xac, 0xa2, 0xac, 0x1f, 0x27, - 0xcb, 0x6c, 0x89, 0xb0, 0x95, 0x2f, 0xbb, 0x9f, 0x34, 0x80, 0x67, 0xcb, 0xd8, 0x91, 0x69, 0x1a, - 0xbc, 0x92, 0xf8, 0x00, 0xf4, 0xec, 0x22, 0x96, 0x26, 0xeb, 0x68, 0xbd, 0xe6, 0xe0, 0x76, 0x7f, - 0x97, 0xec, 0xef, 0x52, 0x7d, 0xff, 0x22, 0x96, 0x5c, 0x05, 0xf1, 0x2e, 0xe8, 0xb1, 0x94, 0x89, - 0xa9, 0x75, 0x58, 0xaf, 0x3e, 0x30, 0xca, 0x85, 0xa9, 0x94, 0x09, 0x57, 0x2e, 0x3e, 0x86, 0x7a, - 0x22, 0x53, 0x99, 0x9c, 0x07, 0x59, 0xb4, 0x7c, 0x67, 0x56, 0x54, 0xb8, 0x55, 0x0e, 0xf3, 0x9d, - 0xcd, 0xcb, 0x59, 0xbc, 0x07, 0xd5, 0x37, 0xd1, 0xdb, 0x28, 0x33, 0x75, 0x55, 0x3a, 0x2c, 0x97, - 0x26, 0xb9, 0xc1, 0x0b, 0x1f, 0x4f, 0xa1, 0x96, 0x66, 0x41, 0xb6, 0x4a, 0xcd, 0x6a, 0x87, 0xf5, - 0x9a, 0x03, 0x2c, 0x27, 0x85, 0x72, 0xf8, 0x26, 0xd1, 0xbd, 0x0f, 0x7a, 0xce, 0x80, 0x75, 0xd8, - 0xe7, 0x24, 0x88, 0xbf, 0x20, 0x63, 0x2f, 0x17, 0x23, 0xcf, 0x75, 0x69, 0xe4, 0x1b, 0x0c, 0x01, - 0x6a, 0xc2, 0x1f, 0xfa, 0x33, 0x61, 0x68, 0xdd, 0x9f, 0x0c, 0xea, 0x22, 0xdb, 0x8d, 0xf4, 0xf0, - 0xda, 0x48, 0x27, 0xd7, 0xef, 0xf9, 0x8f, 0x95, 0xb6, 0xa8, 0x95, 0x7f, 0x46, 0xd5, 0xff, 0x8a, - 0x7a, 0x67, 0x87, 0x7a, 0x45, 0xb7, 0x57, 0xa2, 0x63, 0xf9, 0x16, 0xf9, 0x7f, 0xc0, 0x26, 0x68, - 0x51, 0xa8, 0x98, 0x1a, 0x5c, 0x8b, 0x42, 0xbc, 0x09, 0xd5, 0x20, 0x0c, 0x93, 0xd4, 0xd4, 0x3a, - 0x95, 0x5e, 0x83, 0x17, 0xa2, 0x3b, 0x83, 0x7a, 0xe9, 0xa9, 0xf0, 0x18, 0x6a, 0xf2, 0x7d, 0x1c, - 0x25, 0xc5, 0x18, 0x3a, 0xdf, 0xa8, 0x3f, 0x97, 0xd1, 0x84, 0xfd, 0xf3, 0xe5, 0x6a, 0xf1, 0x5a, - 0x26, 0x0a, 0xb1, 0xc1, 0xaf, 0x64, 0xf7, 0x11, 0x54, 0x15, 0x21, 0xde, 0x82, 0x1b, 0xe1, 0x2a, - 0x29, 0x3e, 0x13, 0xd6, 0x61, 0xbd, 0x03, 0xbe, 0xd5, 0x88, 0xa0, 0x87, 0x41, 0x16, 0xa8, 0x15, - 0x75, 0xae, 0x7e, 0x9f, 0x7e, 0x66, 0x50, 0x2b, 0x88, 0xb1, 0x06, 0x9a, 0xf7, 0xdc, 0x08, 0xd1, - 0x84, 0xa3, 0xe2, 0x51, 0x87, 0xbe, 0xed, 0xb9, 0x73, 0x4e, 0xe3, 0x99, 0x20, 0xcb, 0xb8, 0x64, - 0x78, 0x02, 0x2d, 0x4e, 0xc2, 0x9b, 0xf1, 0x11, 0xcd, 0x27, 0xb6, 0x63, 0xfb, 0x73, 0x3a, 0x1b, - 0x11, 0x59, 0x64, 0x19, 0x5f, 0x18, 0x1e, 0xc3, 0xe1, 0x94, 0xb8, 0x63, 0x0b, 0x91, 0xd7, 0x2c, - 0x72, 0x6d, 0xb2, 0x8c, 0xaf, 0xea, 0x7c, 0xb3, 0x5c, 0x7e, 0x3e, 0x1e, 0xda, 0x13, 0xb2, 0x8c, - 0x6f, 0x0c, 0x8f, 0xa0, 0xe9, 0x7a, 0xf3, 0xd2, 0x55, 0xc6, 0x77, 0x15, 0x76, 0x86, 0x93, 0xb1, - 0xc7, 0x1d, 0xb2, 0xe6, 0x0e, 0x09, 0x31, 0x7c, 0x4a, 0xc6, 0x87, 0x0a, 0xb6, 0x00, 0x67, 0x2e, - 0x9d, 0x4d, 0x69, 0xe4, 0x97, 0x8c, 0x8f, 0x95, 0x27, 0x8d, 0xcb, 0x75, 0x9b, 0xfd, 0x58, 0xb7, - 0xd9, 0xaf, 0x75, 0x9b, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x63, 0x19, 0x1e, 0x6c, 0xaa, 0x03, - 0x00, 0x00, -} - -func (m *HopMessage) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (x *Peer) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HopMessage) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +func (*Peer) ProtoMessage() {} -func (m *HopMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Status != nil { - i = encodeVarintCircuit(dAtA, i, uint64(*m.Status)) - i-- - dAtA[i] = 0x28 - } - if m.Limit != nil { - { - size, err := m.Limit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCircuit(dAtA, i, uint64(size)) +func (x *Peer) ProtoReflect() protoreflect.Message { + mi := &file_pb_circuit_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - i-- - dAtA[i] = 0x22 - } - if m.Reservation != nil { - { - size, err := m.Reservation.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCircuit(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Peer != nil { - { - size, err := m.Peer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCircuit(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Type == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") - } else { - i = encodeVarintCircuit(dAtA, i, uint64(*m.Type)) - i-- - dAtA[i] = 0x8 + return ms } - return len(dAtA) - i, nil + return mi.MessageOf(x) } -func (m *StopMessage) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StopMessage) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// Deprecated: Use Peer.ProtoReflect.Descriptor instead. +func (*Peer) Descriptor() ([]byte, []int) { + return file_pb_circuit_proto_rawDescGZIP(), []int{2} } -func (m *StopMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Status != nil { - i = encodeVarintCircuit(dAtA, i, uint64(*m.Status)) - i-- - dAtA[i] = 0x20 - } - if m.Limit != nil { - { - size, err := m.Limit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCircuit(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Peer != nil { - { - size, err := m.Peer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCircuit(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Type == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") - } else { - i = encodeVarintCircuit(dAtA, i, uint64(*m.Type)) - i-- - dAtA[i] = 0x8 +func (x *Peer) GetId() []byte { + if x != nil { + return x.Id } - return len(dAtA) - i, nil + return nil } -func (m *Peer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *Peer) GetAddrs() [][]byte { + if x != nil { + return x.Addrs } - return dAtA[:n], nil + return nil } -func (m *Peer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +type Reservation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Peer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Addrs) > 0 { - for iNdEx := len(m.Addrs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addrs[iNdEx]) - copy(dAtA[i:], m.Addrs[iNdEx]) - i = encodeVarintCircuit(dAtA, i, uint64(len(m.Addrs[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Id == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") - } else { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintCircuit(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + Expire *uint64 `protobuf:"varint,1,req,name=expire" json:"expire,omitempty"` // Unix expiration time (UTC) + Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` // relay addrs for reserving peer + Voucher []byte `protobuf:"bytes,3,opt,name=voucher" json:"voucher,omitempty"` // reservation voucher } -func (m *Reservation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *Reservation) Reset() { + *x = Reservation{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_circuit_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return dAtA[:n], nil } -func (m *Reservation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *Reservation) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Reservation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Voucher != nil { - i -= len(m.Voucher) - copy(dAtA[i:], m.Voucher) - i = encodeVarintCircuit(dAtA, i, uint64(len(m.Voucher))) - i-- - dAtA[i] = 0x1a - } - if len(m.Addrs) > 0 { - for iNdEx := len(m.Addrs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addrs[iNdEx]) - copy(dAtA[i:], m.Addrs[iNdEx]) - i = encodeVarintCircuit(dAtA, i, uint64(len(m.Addrs[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Expire == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("expire") - } else { - i = encodeVarintCircuit(dAtA, i, uint64(*m.Expire)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} +func (*Reservation) ProtoMessage() {} -func (m *Limit) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *Reservation) ProtoReflect() protoreflect.Message { + mi := &file_pb_circuit_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return dAtA[:n], nil + return mi.MessageOf(x) } -func (m *Limit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// Deprecated: Use Reservation.ProtoReflect.Descriptor instead. +func (*Reservation) Descriptor() ([]byte, []int) { + return file_pb_circuit_proto_rawDescGZIP(), []int{3} } -func (m *Limit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) +func (x *Reservation) GetExpire() uint64 { + if x != nil && x.Expire != nil { + return *x.Expire } - if m.Data != nil { - i = encodeVarintCircuit(dAtA, i, uint64(*m.Data)) - i-- - dAtA[i] = 0x10 - } - if m.Duration != nil { - i = encodeVarintCircuit(dAtA, i, uint64(*m.Duration)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil + return 0 } -func encodeVarintCircuit(dAtA []byte, offset int, v uint64) int { - offset -= sovCircuit(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *HopMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != nil { - n += 1 + sovCircuit(uint64(*m.Type)) - } - if m.Peer != nil { - l = m.Peer.Size() - n += 1 + l + sovCircuit(uint64(l)) - } - if m.Reservation != nil { - l = m.Reservation.Size() - n += 1 + l + sovCircuit(uint64(l)) - } - if m.Limit != nil { - l = m.Limit.Size() - n += 1 + l + sovCircuit(uint64(l)) - } - if m.Status != nil { - n += 1 + sovCircuit(uint64(*m.Status)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (x *Reservation) GetAddrs() [][]byte { + if x != nil { + return x.Addrs } - return n + return nil } -func (m *StopMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != nil { - n += 1 + sovCircuit(uint64(*m.Type)) - } - if m.Peer != nil { - l = m.Peer.Size() - n += 1 + l + sovCircuit(uint64(l)) - } - if m.Limit != nil { - l = m.Limit.Size() - n += 1 + l + sovCircuit(uint64(l)) - } - if m.Status != nil { - n += 1 + sovCircuit(uint64(*m.Status)) +func (x *Reservation) GetVoucher() []byte { + if x != nil { + return x.Voucher } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return nil } -func (m *Peer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != nil { - l = len(m.Id) - n += 1 + l + sovCircuit(uint64(l)) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - l = len(b) - n += 1 + l + sovCircuit(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} +type Limit struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Reservation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Expire != nil { - n += 1 + sovCircuit(uint64(*m.Expire)) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - l = len(b) - n += 1 + l + sovCircuit(uint64(l)) - } - } - if m.Voucher != nil { - l = len(m.Voucher) - n += 1 + l + sovCircuit(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + Duration *uint32 `protobuf:"varint,1,opt,name=duration" json:"duration,omitempty"` // seconds + Data *uint64 `protobuf:"varint,2,opt,name=data" json:"data,omitempty"` // bytes } -func (m *Limit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Duration != nil { - n += 1 + sovCircuit(uint64(*m.Duration)) +func (x *Limit) Reset() { + *x = Limit{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_circuit_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - if m.Data != nil { - n += 1 + sovCircuit(uint64(*m.Data)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n } -func sovCircuit(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCircuit(x uint64) (n int) { - return sovCircuit(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (x *Limit) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HopMessage) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HopMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HopMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var v HopMessage_Type - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= HopMessage_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Type = &v - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Peer == nil { - m.Peer = &Peer{} - } - if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reservation", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Reservation == nil { - m.Reservation = &Reservation{} - } - if err := m.Reservation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Limit == nil { - m.Limit = &Limit{} - } - if err := m.Limit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var v Status - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= Status(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Status = &v - default: - iNdEx = preIndex - skippy, err := skipCircuit(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCircuit - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StopMessage) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StopMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StopMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var v StopMessage_Type - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= StopMessage_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Type = &v - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Peer == nil { - m.Peer = &Peer{} - } - if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Limit == nil { - m.Limit = &Limit{} - } - if err := m.Limit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var v Status - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= Status(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Status = &v - default: - iNdEx = preIndex - skippy, err := skipCircuit(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCircuit - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") - } +func (*Limit) ProtoMessage() {} - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Peer) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Peer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Peer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, make([]byte, postIndex-iNdEx)) - copy(m.Addrs[len(m.Addrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCircuit(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCircuit - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy +func (x *Limit) ProtoReflect() protoreflect.Message { + mi := &file_pb_circuit_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") - } + return mi.MessageOf(x) +} - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +// Deprecated: Use Limit.ProtoReflect.Descriptor instead. +func (*Limit) Descriptor() ([]byte, []int) { + return file_pb_circuit_proto_rawDescGZIP(), []int{4} } -func (m *Reservation) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Reservation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Reservation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expire", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Expire = &v - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, make([]byte, postIndex-iNdEx)) - copy(m.Addrs[len(m.Addrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voucher", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCircuit - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCircuit - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voucher = append(m.Voucher[:0], dAtA[iNdEx:postIndex]...) - if m.Voucher == nil { - m.Voucher = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCircuit(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCircuit - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("expire") - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *Limit) GetDuration() uint32 { + if x != nil && x.Duration != nil { + return *x.Duration } - return nil + return 0 } -func (m *Limit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Limit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Limit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Duration = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCircuit - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Data = &v - default: - iNdEx = preIndex - skippy, err := skipCircuit(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCircuit - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *Limit) GetData() uint64 { + if x != nil && x.Data != nil { + return *x.Data } - return nil + return 0 } -func skipCircuit(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 { - if shift >= 64 { - return 0, ErrIntOverflowCircuit - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCircuit - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCircuit - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthCircuit - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCircuit - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCircuit - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF + +var File_pb_circuit_proto protoreflect.FileDescriptor + +var file_pb_circuit_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x70, 0x62, 0x2f, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0a, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x22, 0xa1, + 0x02, 0x0a, 0x0a, 0x48, 0x6f, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2f, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x63, 0x69, + 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x6f, 0x70, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x24, + 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, + 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, + 0x70, 0x65, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x69, 0x72, 0x63, + 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x27, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x69, 0x72, 0x63, 0x75, + 0x69, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x22, 0x2c, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, + 0x52, 0x45, 0x53, 0x45, 0x52, 0x56, 0x45, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x4e, + 0x4e, 0x45, 0x43, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, + 0x10, 0x02, 0x22, 0xdb, 0x01, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, + 0x32, 0x1c, 0x2e, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, + 0x6f, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x2e, + 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x69, 0x72, 0x63, + 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0x1f, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x4e, 0x4e, 0x45, + 0x43, 0x54, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x01, + 0x22, 0x2c, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x02, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x22, 0x55, + 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, + 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x04, 0x52, 0x06, 0x65, + 0x78, 0x70, 0x69, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0c, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, + 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x76, 0x6f, + 0x75, 0x63, 0x68, 0x65, 0x72, 0x22, 0x37, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1a, + 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x2a, 0xbe, + 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, + 0x64, 0x12, 0x18, 0x0a, 0x13, 0x52, 0x45, 0x53, 0x45, 0x52, 0x56, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x52, 0x45, 0x46, 0x55, 0x53, 0x45, 0x44, 0x10, 0xc8, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x52, + 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x5f, 0x45, 0x58, + 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0xc9, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x45, 0x52, + 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0xca, + 0x01, 0x12, 0x16, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0xcb, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x4e, 0x4f, 0x5f, + 0x52, 0x45, 0x53, 0x45, 0x52, 0x56, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0xcc, 0x01, 0x12, 0x16, + 0x0a, 0x11, 0x4d, 0x41, 0x4c, 0x46, 0x4f, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x4d, 0x45, 0x53, 0x53, + 0x41, 0x47, 0x45, 0x10, 0x90, 0x03, 0x12, 0x17, 0x0a, 0x12, 0x55, 0x4e, 0x45, 0x58, 0x50, 0x45, + 0x43, 0x54, 0x45, 0x44, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x91, 0x03, } var ( - ErrInvalidLengthCircuit = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCircuit = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCircuit = fmt.Errorf("proto: unexpected end of group") + file_pb_circuit_proto_rawDescOnce sync.Once + file_pb_circuit_proto_rawDescData = file_pb_circuit_proto_rawDesc ) + +func file_pb_circuit_proto_rawDescGZIP() []byte { + file_pb_circuit_proto_rawDescOnce.Do(func() { + file_pb_circuit_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_circuit_proto_rawDescData) + }) + return file_pb_circuit_proto_rawDescData +} + +var file_pb_circuit_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_pb_circuit_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_pb_circuit_proto_goTypes = []interface{}{ + (Status)(0), // 0: circuit.pb.Status + (HopMessage_Type)(0), // 1: circuit.pb.HopMessage.Type + (StopMessage_Type)(0), // 2: circuit.pb.StopMessage.Type + (*HopMessage)(nil), // 3: circuit.pb.HopMessage + (*StopMessage)(nil), // 4: circuit.pb.StopMessage + (*Peer)(nil), // 5: circuit.pb.Peer + (*Reservation)(nil), // 6: circuit.pb.Reservation + (*Limit)(nil), // 7: circuit.pb.Limit +} +var file_pb_circuit_proto_depIdxs = []int32{ + 1, // 0: circuit.pb.HopMessage.type:type_name -> circuit.pb.HopMessage.Type + 5, // 1: circuit.pb.HopMessage.peer:type_name -> circuit.pb.Peer + 6, // 2: circuit.pb.HopMessage.reservation:type_name -> circuit.pb.Reservation + 7, // 3: circuit.pb.HopMessage.limit:type_name -> circuit.pb.Limit + 0, // 4: circuit.pb.HopMessage.status:type_name -> circuit.pb.Status + 2, // 5: circuit.pb.StopMessage.type:type_name -> circuit.pb.StopMessage.Type + 5, // 6: circuit.pb.StopMessage.peer:type_name -> circuit.pb.Peer + 7, // 7: circuit.pb.StopMessage.limit:type_name -> circuit.pb.Limit + 0, // 8: circuit.pb.StopMessage.status:type_name -> circuit.pb.Status + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_pb_circuit_proto_init() } +func file_pb_circuit_proto_init() { + if File_pb_circuit_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_circuit_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HopMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_circuit_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_circuit_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Peer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_circuit_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Reservation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_circuit_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Limit); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_circuit_proto_rawDesc, + NumEnums: 3, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_circuit_proto_goTypes, + DependencyIndexes: file_pb_circuit_proto_depIdxs, + EnumInfos: file_pb_circuit_proto_enumTypes, + MessageInfos: file_pb_circuit_proto_msgTypes, + }.Build() + File_pb_circuit_proto = out.File + file_pb_circuit_proto_rawDesc = nil + file_pb_circuit_proto_goTypes = nil + file_pb_circuit_proto_depIdxs = nil +} diff --git a/p2p/protocol/circuitv2/pb/voucher.pb.go b/p2p/protocol/circuitv2/pb/voucher.pb.go index 6fed0082e2..95d5603cdb 100644 --- a/p2p/protocol/circuitv2/pb/voucher.pb.go +++ b/p2p/protocol/circuitv2/pb/voucher.pb.go @@ -1,438 +1,160 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: voucher.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/voucher.proto -package circuit_pb +package pb import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type ReservationVoucher struct { - Relay []byte `protobuf:"bytes,1,req,name=relay" json:"relay,omitempty"` - Peer []byte `protobuf:"bytes,2,req,name=peer" json:"peer,omitempty"` - Expiration *uint64 `protobuf:"varint,3,req,name=expiration" json:"expiration,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Relay []byte `protobuf:"bytes,1,req,name=relay" json:"relay,omitempty"` + Peer []byte `protobuf:"bytes,2,req,name=peer" json:"peer,omitempty"` + Expiration *uint64 `protobuf:"varint,3,req,name=expiration" json:"expiration,omitempty"` } -func (m *ReservationVoucher) Reset() { *m = ReservationVoucher{} } -func (m *ReservationVoucher) String() string { return proto.CompactTextString(m) } -func (*ReservationVoucher) ProtoMessage() {} -func (*ReservationVoucher) Descriptor() ([]byte, []int) { - return fileDescriptor_a22a9b0d3335ba25, []int{0} +func (x *ReservationVoucher) Reset() { + *x = ReservationVoucher{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_voucher_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReservationVoucher) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *ReservationVoucher) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReservationVoucher) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ReservationVoucher.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*ReservationVoucher) ProtoMessage() {} + +func (x *ReservationVoucher) ProtoReflect() protoreflect.Message { + mi := &file_pb_voucher_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *ReservationVoucher) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReservationVoucher.Merge(m, src) -} -func (m *ReservationVoucher) XXX_Size() int { - return m.Size() -} -func (m *ReservationVoucher) XXX_DiscardUnknown() { - xxx_messageInfo_ReservationVoucher.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_ReservationVoucher proto.InternalMessageInfo +// Deprecated: Use ReservationVoucher.ProtoReflect.Descriptor instead. +func (*ReservationVoucher) Descriptor() ([]byte, []int) { + return file_pb_voucher_proto_rawDescGZIP(), []int{0} +} -func (m *ReservationVoucher) GetRelay() []byte { - if m != nil { - return m.Relay +func (x *ReservationVoucher) GetRelay() []byte { + if x != nil { + return x.Relay } return nil } -func (m *ReservationVoucher) GetPeer() []byte { - if m != nil { - return m.Peer +func (x *ReservationVoucher) GetPeer() []byte { + if x != nil { + return x.Peer } return nil } -func (m *ReservationVoucher) GetExpiration() uint64 { - if m != nil && m.Expiration != nil { - return *m.Expiration +func (x *ReservationVoucher) GetExpiration() uint64 { + if x != nil && x.Expiration != nil { + return *x.Expiration } return 0 } -func init() { - proto.RegisterType((*ReservationVoucher)(nil), "circuit.pb.ReservationVoucher") -} - -func init() { proto.RegisterFile("voucher.proto", fileDescriptor_a22a9b0d3335ba25) } - -var fileDescriptor_a22a9b0d3335ba25 = []byte{ - // 135 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2d, 0xcb, 0x2f, 0x4d, - 0xce, 0x48, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4a, 0xce, 0x2c, 0x4a, 0x2e, - 0xcd, 0x2c, 0xd1, 0x2b, 0x48, 0x52, 0x8a, 0xe3, 0x12, 0x0a, 0x4a, 0x2d, 0x4e, 0x2d, 0x2a, 0x4b, - 0x2c, 0xc9, 0xcc, 0xcf, 0x0b, 0x83, 0xa8, 0x13, 0x12, 0xe1, 0x62, 0x2d, 0x4a, 0xcd, 0x49, 0xac, - 0x94, 0x60, 0x54, 0x60, 0xd2, 0xe0, 0x09, 0x82, 0x70, 0x84, 0x84, 0xb8, 0x58, 0x0a, 0x52, 0x53, - 0x8b, 0x24, 0x98, 0xc0, 0x82, 0x60, 0xb6, 0x90, 0x1c, 0x17, 0x57, 0x6a, 0x45, 0x41, 0x66, 0x11, - 0x58, 0xbb, 0x04, 0xb3, 0x02, 0x93, 0x06, 0x4b, 0x10, 0x92, 0x88, 0x13, 0xcf, 0x89, 0x47, 0x72, - 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x08, 0x08, 0x00, 0x00, 0xff, 0xff, 0xc0, - 0x81, 0x3a, 0xee, 0x89, 0x00, 0x00, 0x00, -} - -func (m *ReservationVoucher) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ReservationVoucher) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +var File_pb_voucher_proto protoreflect.FileDescriptor -func (m *ReservationVoucher) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Expiration == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("expiration") - } else { - i = encodeVarintVoucher(dAtA, i, uint64(*m.Expiration)) - i-- - dAtA[i] = 0x18 - } - if m.Peer == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("peer") - } else { - i -= len(m.Peer) - copy(dAtA[i:], m.Peer) - i = encodeVarintVoucher(dAtA, i, uint64(len(m.Peer))) - i-- - dAtA[i] = 0x12 - } - if m.Relay == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("relay") - } else { - i -= len(m.Relay) - copy(dAtA[i:], m.Relay) - i = encodeVarintVoucher(dAtA, i, uint64(len(m.Relay))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +var file_pb_voucher_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x70, 0x62, 0x2f, 0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0a, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x62, 0x22, 0x5e, + 0x0a, 0x12, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x6f, 0x75, + 0x63, 0x68, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x01, 0x20, + 0x02, 0x28, 0x0c, 0x52, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x65, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x1e, + 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x02, + 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, } -func encodeVarintVoucher(dAtA []byte, offset int, v uint64) int { - offset -= sovVoucher(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ReservationVoucher) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Relay != nil { - l = len(m.Relay) - n += 1 + l + sovVoucher(uint64(l)) - } - if m.Peer != nil { - l = len(m.Peer) - n += 1 + l + sovVoucher(uint64(l)) - } - if m.Expiration != nil { - n += 1 + sovVoucher(uint64(*m.Expiration)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovVoucher(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozVoucher(x uint64) (n int) { - return sovVoucher(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ReservationVoucher) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVoucher - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ReservationVoucher: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ReservationVoucher: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Relay", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVoucher - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVoucher - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVoucher - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Relay = append(m.Relay[:0], dAtA[iNdEx:postIndex]...) - if m.Relay == nil { - m.Relay = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVoucher - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVoucher - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVoucher - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Peer = append(m.Peer[:0], dAtA[iNdEx:postIndex]...) - if m.Peer == nil { - m.Peer = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVoucher - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Expiration = &v - hasFields[0] |= uint64(0x00000004) - default: - iNdEx = preIndex - skippy, err := skipVoucher(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVoucher - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVoucher - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("relay") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("peer") - } - if hasFields[0]&uint64(0x00000004) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("expiration") - } +var ( + file_pb_voucher_proto_rawDescOnce sync.Once + file_pb_voucher_proto_rawDescData = file_pb_voucher_proto_rawDesc +) - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipVoucher(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 { - if shift >= 64 { - return 0, ErrIntOverflowVoucher - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break +func file_pb_voucher_proto_rawDescGZIP() []byte { + file_pb_voucher_proto_rawDescOnce.Do(func() { + file_pb_voucher_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_voucher_proto_rawDescData) + }) + return file_pb_voucher_proto_rawDescData +} + +var file_pb_voucher_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pb_voucher_proto_goTypes = []interface{}{ + (*ReservationVoucher)(nil), // 0: circuit.pb.ReservationVoucher +} +var file_pb_voucher_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_pb_voucher_proto_init() } +func file_pb_voucher_proto_init() { + if File_pb_voucher_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_voucher_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReservationVoucher); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVoucher - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVoucher - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthVoucher - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupVoucher - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthVoucher - } - if depth == 0 { - return iNdEx, nil - } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_voucher_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_voucher_proto_goTypes, + DependencyIndexes: file_pb_voucher_proto_depIdxs, + MessageInfos: file_pb_voucher_proto_msgTypes, + }.Build() + File_pb_voucher_proto = out.File + file_pb_voucher_proto_rawDesc = nil + file_pb_voucher_proto_goTypes = nil + file_pb_voucher_proto_depIdxs = nil } - -var ( - ErrInvalidLengthVoucher = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVoucher = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupVoucher = fmt.Errorf("proto: unexpected end of group") -) diff --git a/p2p/protocol/circuitv2/proto.go b/p2p/protocol/circuitv2/proto.go new file mode 100644 index 0000000000..d0e0436cb1 --- /dev/null +++ b/p2p/protocol/circuitv2/proto.go @@ -0,0 +1,4 @@ +package circuitv2 + +//go:generate protoc --proto_path=$PWD:$PWD/../../.. --go_out=. --go_opt=Mpb/circuit.proto=./pb pb/circuit.proto +//go:generate protoc --proto_path=$PWD:$PWD/../../.. --go_out=. --go_opt=Mpb/voucher.proto=./pb pb/voucher.proto diff --git a/p2p/protocol/circuitv2/proto/voucher.go b/p2p/protocol/circuitv2/proto/voucher.go index fd50fccce6..7114d81c65 100644 --- a/p2p/protocol/circuitv2/proto/voucher.go +++ b/p2p/protocol/circuitv2/proto/voucher.go @@ -6,6 +6,8 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/record" pbv2 "github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/pb" + + "google.golang.org/protobuf/proto" ) const RecordDomain = "libp2p-relay-rsvp" @@ -37,21 +39,17 @@ func (rv *ReservationVoucher) Codec() []byte { } func (rv *ReservationVoucher) MarshalRecord() ([]byte, error) { - relay := []byte(rv.Relay) - peer := []byte(rv.Peer) expiration := uint64(rv.Expiration.Unix()) - pbrv := &pbv2.ReservationVoucher{ - Relay: relay, - Peer: peer, + return proto.Marshal(&pbv2.ReservationVoucher{ + Relay: []byte(rv.Relay), + Peer: []byte(rv.Peer), Expiration: &expiration, - } - - return pbrv.Marshal() + }) } func (rv *ReservationVoucher) UnmarshalRecord(blob []byte) error { pbrv := pbv2.ReservationVoucher{} - err := pbrv.Unmarshal(blob) + err := proto.Unmarshal(blob, &pbrv) if err != nil { return err } diff --git a/p2p/protocol/circuitv2/util/io.go b/p2p/protocol/circuitv2/util/io.go index de314b18e9..2a314540c1 100644 --- a/p2p/protocol/circuitv2/util/io.go +++ b/p2p/protocol/circuitv2/util/io.go @@ -7,8 +7,8 @@ import ( pool "github.com/libp2p/go-buffer-pool" "github.com/libp2p/go-msgio/protoio" - "github.com/gogo/protobuf/proto" "github.com/multiformats/go-varint" + "google.golang.org/protobuf/proto" ) type DelimitedReader struct { diff --git a/p2p/protocol/holepunch/holepuncher.go b/p2p/protocol/holepunch/holepuncher.go index 5cf8f8fd22..e642f9d750 100644 --- a/p2p/protocol/holepunch/holepuncher.go +++ b/p2p/protocol/holepunch/holepuncher.go @@ -10,7 +10,7 @@ import ( "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" - pb "github.com/libp2p/go-libp2p/p2p/protocol/holepunch/pb" + "github.com/libp2p/go-libp2p/p2p/protocol/holepunch/pb" "github.com/libp2p/go-libp2p/p2p/protocol/identify" "github.com/libp2p/go-msgio/protoio" @@ -19,6 +19,8 @@ import ( manet "github.com/multiformats/go-multiaddr/net" ) +//go:generate protoc --proto_path=$PWD:$PWD/../../.. --go_out=. --go_opt=Mpb/holepunch.proto=./pb pb/holepunch.proto + // ErrHolePunchActive is returned from DirectConnect when another hole punching attempt is currently running var ErrHolePunchActive = errors.New("another hole punching attempt to this peer is active") diff --git a/p2p/protocol/holepunch/pb/Makefile b/p2p/protocol/holepunch/pb/Makefile deleted file mode 100644 index eb14b5768a..0000000000 --- a/p2p/protocol/holepunch/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/p2p/protocol/holepunch/pb/holepunch.pb.go b/p2p/protocol/holepunch/pb/holepunch.pb.go index 3d7e21acf6..1f9b576c3e 100644 --- a/p2p/protocol/holepunch/pb/holepunch.pb.go +++ b/p2p/protocol/holepunch/pb/holepunch.pb.go @@ -1,27 +1,24 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: holepunch.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/holepunch.proto -package holepunch_pb +package pb import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type HolePunch_Type int32 @@ -30,15 +27,17 @@ const ( HolePunch_SYNC HolePunch_Type = 300 ) -var HolePunch_Type_name = map[int32]string{ - 100: "CONNECT", - 300: "SYNC", -} - -var HolePunch_Type_value = map[string]int32{ - "CONNECT": 100, - "SYNC": 300, -} +// Enum value maps for HolePunch_Type. +var ( + HolePunch_Type_name = map[int32]string{ + 100: "CONNECT", + 300: "SYNC", + } + HolePunch_Type_value = map[string]int32{ + "CONNECT": 100, + "SYNC": 300, + } +) func (x HolePunch_Type) Enum() *HolePunch_Type { p := new(HolePunch_Type) @@ -47,369 +46,170 @@ func (x HolePunch_Type) Enum() *HolePunch_Type { } func (x HolePunch_Type) String() string { - return proto.EnumName(HolePunch_Type_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HolePunch_Type) Descriptor() protoreflect.EnumDescriptor { + return file_pb_holepunch_proto_enumTypes[0].Descriptor() +} + +func (HolePunch_Type) Type() protoreflect.EnumType { + return &file_pb_holepunch_proto_enumTypes[0] } -func (x *HolePunch_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(HolePunch_Type_value, data, "HolePunch_Type") +func (x HolePunch_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *HolePunch_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = HolePunch_Type(value) + *x = HolePunch_Type(num) return nil } +// Deprecated: Use HolePunch_Type.Descriptor instead. func (HolePunch_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_290ddea0f23ef64a, []int{0, 0} + return file_pb_holepunch_proto_rawDescGZIP(), []int{0, 0} } // spec: https://github.com/libp2p/specs/blob/master/relay/DCUtR.md type HolePunch struct { - Type *HolePunch_Type `protobuf:"varint,1,req,name=type,enum=holepunch.pb.HolePunch_Type" json:"type,omitempty"` - ObsAddrs [][]byte `protobuf:"bytes,2,rep,name=ObsAddrs" json:"ObsAddrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *HolePunch) Reset() { *m = HolePunch{} } -func (m *HolePunch) String() string { return proto.CompactTextString(m) } -func (*HolePunch) ProtoMessage() {} -func (*HolePunch) Descriptor() ([]byte, []int) { - return fileDescriptor_290ddea0f23ef64a, []int{0} -} -func (m *HolePunch) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HolePunch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HolePunch.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HolePunch) XXX_Merge(src proto.Message) { - xxx_messageInfo_HolePunch.Merge(m, src) -} -func (m *HolePunch) XXX_Size() int { - return m.Size() -} -func (m *HolePunch) XXX_DiscardUnknown() { - xxx_messageInfo_HolePunch.DiscardUnknown(m) + Type *HolePunch_Type `protobuf:"varint,1,req,name=type,enum=holepunch.pb.HolePunch_Type" json:"type,omitempty"` + ObsAddrs [][]byte `protobuf:"bytes,2,rep,name=ObsAddrs" json:"ObsAddrs,omitempty"` } -var xxx_messageInfo_HolePunch proto.InternalMessageInfo - -func (m *HolePunch) GetType() HolePunch_Type { - if m != nil && m.Type != nil { - return *m.Type +func (x *HolePunch) Reset() { + *x = HolePunch{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_holepunch_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return HolePunch_CONNECT } -func (m *HolePunch) GetObsAddrs() [][]byte { - if m != nil { - return m.ObsAddrs - } - return nil -} - -func init() { - proto.RegisterEnum("holepunch.pb.HolePunch_Type", HolePunch_Type_name, HolePunch_Type_value) - proto.RegisterType((*HolePunch)(nil), "holepunch.pb.HolePunch") +func (x *HolePunch) String() string { + return protoimpl.X.MessageStringOf(x) } -func init() { proto.RegisterFile("holepunch.proto", fileDescriptor_290ddea0f23ef64a) } - -var fileDescriptor_290ddea0f23ef64a = []byte{ - // 153 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcf, 0xc8, 0xcf, 0x49, - 0x2d, 0x28, 0xcd, 0x4b, 0xce, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x41, 0x12, 0x48, - 0x52, 0xaa, 0xe4, 0xe2, 0xf4, 0xc8, 0xcf, 0x49, 0x0d, 0x00, 0xf1, 0x85, 0x0c, 0xb8, 0x58, 0x4a, - 0x2a, 0x0b, 0x52, 0x25, 0x18, 0x15, 0x98, 0x34, 0xf8, 0x8c, 0x64, 0xf4, 0x90, 0x55, 0xea, 0xc1, - 0x95, 0xe9, 0x85, 0x54, 0x16, 0xa4, 0x06, 0x81, 0x55, 0x0a, 0x49, 0x71, 0x71, 0xf8, 0x27, 0x15, - 0x3b, 0xa6, 0xa4, 0x14, 0x15, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0xf0, 0x04, 0xc1, 0xf9, 0x4a, 0x72, - 0x5c, 0x2c, 0x20, 0x95, 0x42, 0xdc, 0x5c, 0xec, 0xce, 0xfe, 0x7e, 0x7e, 0xae, 0xce, 0x21, 0x02, - 0x29, 0x42, 0x9c, 0x5c, 0x2c, 0xc1, 0x91, 0x7e, 0xce, 0x02, 0x6b, 0x98, 0x9c, 0x78, 0x4e, 0x3c, - 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0x46, 0x40, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x34, 0x8d, 0x41, 0x7d, 0xa8, 0x00, 0x00, 0x00, -} +func (*HolePunch) ProtoMessage() {} -func (m *HolePunch) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *HolePunch) ProtoReflect() protoreflect.Message { + mi := &file_pb_holepunch_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return dAtA[:n], nil + return mi.MessageOf(x) } -func (m *HolePunch) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// Deprecated: Use HolePunch.ProtoReflect.Descriptor instead. +func (*HolePunch) Descriptor() ([]byte, []int) { + return file_pb_holepunch_proto_rawDescGZIP(), []int{0} } -func (m *HolePunch) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.ObsAddrs) > 0 { - for iNdEx := len(m.ObsAddrs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ObsAddrs[iNdEx]) - copy(dAtA[i:], m.ObsAddrs[iNdEx]) - i = encodeVarintHolepunch(dAtA, i, uint64(len(m.ObsAddrs[iNdEx]))) - i-- - dAtA[i] = 0x12 - } +func (x *HolePunch) GetType() HolePunch_Type { + if x != nil && x.Type != nil { + return *x.Type } - if m.Type == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") - } else { - i = encodeVarintHolepunch(dAtA, i, uint64(*m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil + return HolePunch_CONNECT } -func encodeVarintHolepunch(dAtA []byte, offset int, v uint64) int { - offset -= sovHolepunch(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *HolePunch) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != nil { - n += 1 + sovHolepunch(uint64(*m.Type)) +func (x *HolePunch) GetObsAddrs() [][]byte { + if x != nil { + return x.ObsAddrs } - if len(m.ObsAddrs) > 0 { - for _, b := range m.ObsAddrs { - l = len(b) - n += 1 + l + sovHolepunch(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return nil } -func sovHolepunch(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozHolepunch(x uint64) (n int) { - return sovHolepunch(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *HolePunch) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHolepunch - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HolePunch: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HolePunch: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var v HolePunch_Type - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHolepunch - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= HolePunch_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Type = &v - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObsAddrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHolepunch - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthHolepunch - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthHolepunch - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ObsAddrs = append(m.ObsAddrs, make([]byte, postIndex-iNdEx)) - copy(m.ObsAddrs[len(m.ObsAddrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipHolepunch(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthHolepunch - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") - } +var File_pb_holepunch_proto protoreflect.FileDescriptor - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +var file_pb_holepunch_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x62, 0x2f, 0x68, 0x6f, 0x6c, 0x65, 0x70, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x68, 0x6f, 0x6c, 0x65, 0x70, 0x75, 0x6e, 0x63, 0x68, 0x2e, + 0x70, 0x62, 0x22, 0x79, 0x0a, 0x09, 0x48, 0x6f, 0x6c, 0x65, 0x50, 0x75, 0x6e, 0x63, 0x68, 0x12, + 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x1c, 0x2e, + 0x68, 0x6f, 0x6c, 0x65, 0x70, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x6f, 0x6c, + 0x65, 0x50, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4f, 0x62, 0x73, 0x41, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x08, 0x4f, 0x62, 0x73, 0x41, 0x64, 0x64, 0x72, 0x73, 0x22, 0x1e, 0x0a, + 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, + 0x10, 0x64, 0x12, 0x09, 0x0a, 0x04, 0x53, 0x59, 0x4e, 0x43, 0x10, 0xac, 0x02, } -func skipHolepunch(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 { - if shift >= 64 { - return 0, ErrIntOverflowHolepunch - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHolepunch - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHolepunch - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthHolepunch - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupHolepunch + +var ( + file_pb_holepunch_proto_rawDescOnce sync.Once + file_pb_holepunch_proto_rawDescData = file_pb_holepunch_proto_rawDesc +) + +func file_pb_holepunch_proto_rawDescGZIP() []byte { + file_pb_holepunch_proto_rawDescOnce.Do(func() { + file_pb_holepunch_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_holepunch_proto_rawDescData) + }) + return file_pb_holepunch_proto_rawDescData +} + +var file_pb_holepunch_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_pb_holepunch_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pb_holepunch_proto_goTypes = []interface{}{ + (HolePunch_Type)(0), // 0: holepunch.pb.HolePunch.Type + (*HolePunch)(nil), // 1: holepunch.pb.HolePunch +} +var file_pb_holepunch_proto_depIdxs = []int32{ + 0, // 0: holepunch.pb.HolePunch.type:type_name -> holepunch.pb.HolePunch.Type + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pb_holepunch_proto_init() } +func file_pb_holepunch_proto_init() { + if File_pb_holepunch_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_holepunch_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HolePunch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthHolepunch - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_holepunch_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_holepunch_proto_goTypes, + DependencyIndexes: file_pb_holepunch_proto_depIdxs, + EnumInfos: file_pb_holepunch_proto_enumTypes, + MessageInfos: file_pb_holepunch_proto_msgTypes, + }.Build() + File_pb_holepunch_proto = out.File + file_pb_holepunch_proto_rawDesc = nil + file_pb_holepunch_proto_goTypes = nil + file_pb_holepunch_proto_depIdxs = nil } - -var ( - ErrInvalidLengthHolepunch = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowHolepunch = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupHolepunch = fmt.Errorf("proto: unexpected end of group") -) diff --git a/p2p/protocol/identify/id.go b/p2p/protocol/identify/id.go index ecfa8feaed..fc3a405c6a 100644 --- a/p2p/protocol/identify/id.go +++ b/p2p/protocol/identify/id.go @@ -16,17 +16,19 @@ import ( "github.com/libp2p/go-libp2p/core/protocol" "github.com/libp2p/go-libp2p/core/record" "github.com/libp2p/go-libp2p/p2p/host/eventbus" - pb "github.com/libp2p/go-libp2p/p2p/protocol/identify/pb" + "github.com/libp2p/go-libp2p/p2p/protocol/identify/pb" "github.com/libp2p/go-msgio/protoio" - "github.com/gogo/protobuf/proto" logging "github.com/ipfs/go-log/v2" ma "github.com/multiformats/go-multiaddr" manet "github.com/multiformats/go-multiaddr/net" msmux "github.com/multiformats/go-multistream" + "google.golang.org/protobuf/proto" ) +//go:generate protoc --proto_path=$PWD:$PWD/../../.. --go_out=. --go_opt=Mpb/identify.proto=./pb pb/identify.proto + var log = logging.Logger("net/identify") // ID is the protocol.ID of version 1.0.0 of the identify diff --git a/p2p/protocol/identify/pb/Makefile b/p2p/protocol/identify/pb/Makefile deleted file mode 100644 index eb14b5768a..0000000000 --- a/p2p/protocol/identify/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/p2p/protocol/identify/pb/identify.pb.go b/p2p/protocol/identify/pb/identify.pb.go index e0e08d9cb2..dbd387870e 100644 --- a/p2p/protocol/identify/pb/identify.pb.go +++ b/p2p/protocol/identify/pb/identify.pb.go @@ -1,33 +1,35 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: identify.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/identify.proto -package identify_pb +package pb import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Identify struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // protocolVersion determines compatibility between peers - ProtocolVersion *string `protobuf:"bytes,5,opt,name=protocolVersion" json:"protocolVersion,omitempty"` + ProtocolVersion *string `protobuf:"bytes,5,opt,name=protocolVersion" json:"protocolVersion,omitempty"` // e.g. ipfs/1.0.0 // agentVersion is like a UserAgent string in browsers, or client version in bittorrent // includes the client name and client. - AgentVersion *string `protobuf:"bytes,6,opt,name=agentVersion" json:"agentVersion,omitempty"` + AgentVersion *string `protobuf:"bytes,6,opt,name=agentVersion" json:"agentVersion,omitempty"` // e.g. go-ipfs/0.1.0 // publicKey is this node's public key (which also gives its node.ID) // - may not need to be sent, as secure channel implies it has been sent. // - then again, if we change / disable secure channel, may still want it. @@ -45,623 +47,173 @@ type Identify struct { // in a form that lets us share authenticated addrs with other peers. // see github.com/libp2p/go-libp2p/core/record/pb/envelope.proto and // github.com/libp2p/go-libp2p/core/peer/pb/peer_record.proto for message definitions. - SignedPeerRecord []byte `protobuf:"bytes,8,opt,name=signedPeerRecord" json:"signedPeerRecord,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SignedPeerRecord []byte `protobuf:"bytes,8,opt,name=signedPeerRecord" json:"signedPeerRecord,omitempty"` } -func (m *Identify) Reset() { *m = Identify{} } -func (m *Identify) String() string { return proto.CompactTextString(m) } -func (*Identify) ProtoMessage() {} -func (*Identify) Descriptor() ([]byte, []int) { - return fileDescriptor_83f1e7e6b485409f, []int{0} +func (x *Identify) Reset() { + *x = Identify{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_identify_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Identify) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *Identify) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Identify) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Identify.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*Identify) ProtoMessage() {} + +func (x *Identify) ProtoReflect() protoreflect.Message { + mi := &file_pb_identify_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Identify) XXX_Merge(src proto.Message) { - xxx_messageInfo_Identify.Merge(m, src) -} -func (m *Identify) XXX_Size() int { - return m.Size() -} -func (m *Identify) XXX_DiscardUnknown() { - xxx_messageInfo_Identify.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Identify proto.InternalMessageInfo +// Deprecated: Use Identify.ProtoReflect.Descriptor instead. +func (*Identify) Descriptor() ([]byte, []int) { + return file_pb_identify_proto_rawDescGZIP(), []int{0} +} -func (m *Identify) GetProtocolVersion() string { - if m != nil && m.ProtocolVersion != nil { - return *m.ProtocolVersion +func (x *Identify) GetProtocolVersion() string { + if x != nil && x.ProtocolVersion != nil { + return *x.ProtocolVersion } return "" } -func (m *Identify) GetAgentVersion() string { - if m != nil && m.AgentVersion != nil { - return *m.AgentVersion +func (x *Identify) GetAgentVersion() string { + if x != nil && x.AgentVersion != nil { + return *x.AgentVersion } return "" } -func (m *Identify) GetPublicKey() []byte { - if m != nil { - return m.PublicKey +func (x *Identify) GetPublicKey() []byte { + if x != nil { + return x.PublicKey } return nil } -func (m *Identify) GetListenAddrs() [][]byte { - if m != nil { - return m.ListenAddrs +func (x *Identify) GetListenAddrs() [][]byte { + if x != nil { + return x.ListenAddrs } return nil } -func (m *Identify) GetObservedAddr() []byte { - if m != nil { - return m.ObservedAddr +func (x *Identify) GetObservedAddr() []byte { + if x != nil { + return x.ObservedAddr } return nil } -func (m *Identify) GetProtocols() []string { - if m != nil { - return m.Protocols +func (x *Identify) GetProtocols() []string { + if x != nil { + return x.Protocols } return nil } -func (m *Identify) GetSignedPeerRecord() []byte { - if m != nil { - return m.SignedPeerRecord +func (x *Identify) GetSignedPeerRecord() []byte { + if x != nil { + return x.SignedPeerRecord } return nil } -func init() { - proto.RegisterType((*Identify)(nil), "identify.pb.Identify") -} - -func init() { proto.RegisterFile("identify.proto", fileDescriptor_83f1e7e6b485409f) } - -var fileDescriptor_83f1e7e6b485409f = []byte{ - // 213 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x4c, 0x49, 0xcd, - 0x2b, 0xc9, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x46, 0xf0, 0x93, 0x94, - 0xda, 0x98, 0xb8, 0x38, 0x3c, 0xa1, 0x7c, 0x21, 0x0d, 0x2e, 0x7e, 0xb0, 0x92, 0xe4, 0xfc, 0x9c, - 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, 0xfc, 0x3c, 0x09, 0x56, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x74, 0x61, - 0x21, 0x25, 0x2e, 0x9e, 0xc4, 0xf4, 0xd4, 0xbc, 0x12, 0x98, 0x32, 0x36, 0xb0, 0x32, 0x14, 0x31, - 0x21, 0x19, 0x2e, 0xce, 0x82, 0xd2, 0xa4, 0x9c, 0xcc, 0x64, 0xef, 0xd4, 0x4a, 0x09, 0x46, 0x05, - 0x46, 0x0d, 0x9e, 0x20, 0x84, 0x80, 0x90, 0x02, 0x17, 0x77, 0x4e, 0x66, 0x71, 0x49, 0x6a, 0x9e, - 0x63, 0x4a, 0x4a, 0x51, 0xb1, 0x04, 0x93, 0x02, 0xb3, 0x06, 0x4f, 0x10, 0xb2, 0x10, 0xc8, 0x8e, - 0xfc, 0xa4, 0xe2, 0xd4, 0xa2, 0xb2, 0xd4, 0x14, 0x90, 0x80, 0x04, 0x0b, 0xd8, 0x08, 0x14, 0x31, - 0xb0, 0x1d, 0x50, 0xa7, 0x15, 0x4b, 0x30, 0x2b, 0x30, 0x6b, 0x70, 0x06, 0x21, 0x04, 0x84, 0xb4, - 0xb8, 0x04, 0x8a, 0x33, 0xd3, 0xf3, 0x52, 0x53, 0x02, 0x52, 0x53, 0x8b, 0x82, 0x52, 0x93, 0xf3, - 0x8b, 0x52, 0x24, 0x38, 0xc0, 0xa6, 0x60, 0x88, 0x3b, 0xf1, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, - 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc3, 0xb6, 0xc0, - 0x32, 0x34, 0x01, 0x00, 0x00, -} - -func (m *Identify) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Identify) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Identify) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.SignedPeerRecord != nil { - i -= len(m.SignedPeerRecord) - copy(dAtA[i:], m.SignedPeerRecord) - i = encodeVarintIdentify(dAtA, i, uint64(len(m.SignedPeerRecord))) - i-- - dAtA[i] = 0x42 - } - if m.AgentVersion != nil { - i -= len(*m.AgentVersion) - copy(dAtA[i:], *m.AgentVersion) - i = encodeVarintIdentify(dAtA, i, uint64(len(*m.AgentVersion))) - i-- - dAtA[i] = 0x32 - } - if m.ProtocolVersion != nil { - i -= len(*m.ProtocolVersion) - copy(dAtA[i:], *m.ProtocolVersion) - i = encodeVarintIdentify(dAtA, i, uint64(len(*m.ProtocolVersion))) - i-- - dAtA[i] = 0x2a - } - if m.ObservedAddr != nil { - i -= len(m.ObservedAddr) - copy(dAtA[i:], m.ObservedAddr) - i = encodeVarintIdentify(dAtA, i, uint64(len(m.ObservedAddr))) - i-- - dAtA[i] = 0x22 - } - if len(m.Protocols) > 0 { - for iNdEx := len(m.Protocols) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Protocols[iNdEx]) - copy(dAtA[i:], m.Protocols[iNdEx]) - i = encodeVarintIdentify(dAtA, i, uint64(len(m.Protocols[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.ListenAddrs) > 0 { - for iNdEx := len(m.ListenAddrs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ListenAddrs[iNdEx]) - copy(dAtA[i:], m.ListenAddrs[iNdEx]) - i = encodeVarintIdentify(dAtA, i, uint64(len(m.ListenAddrs[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.PublicKey != nil { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintIdentify(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintIdentify(dAtA []byte, offset int, v uint64) int { - offset -= sovIdentify(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Identify) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublicKey != nil { - l = len(m.PublicKey) - n += 1 + l + sovIdentify(uint64(l)) - } - if len(m.ListenAddrs) > 0 { - for _, b := range m.ListenAddrs { - l = len(b) - n += 1 + l + sovIdentify(uint64(l)) - } - } - if len(m.Protocols) > 0 { - for _, s := range m.Protocols { - l = len(s) - n += 1 + l + sovIdentify(uint64(l)) - } - } - if m.ObservedAddr != nil { - l = len(m.ObservedAddr) - n += 1 + l + sovIdentify(uint64(l)) - } - if m.ProtocolVersion != nil { - l = len(*m.ProtocolVersion) - n += 1 + l + sovIdentify(uint64(l)) - } - if m.AgentVersion != nil { - l = len(*m.AgentVersion) - n += 1 + l + sovIdentify(uint64(l)) - } - if m.SignedPeerRecord != nil { - l = len(m.SignedPeerRecord) - n += 1 + l + sovIdentify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +var File_pb_identify_proto protoreflect.FileDescriptor + +var file_pb_identify_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x70, 0x62, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x62, + 0x22, 0x86, 0x02, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x12, 0x28, 0x0a, + 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x6c, 0x69, 0x73, + 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, + 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x6f, + 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0c, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x12, + 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x12, 0x2a, 0x0a, + 0x10, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, + 0x65, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, } -func sovIdentify(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozIdentify(x uint64) (n int) { - return sovIdentify(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Identify) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Identify: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Identify: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListenAddrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ListenAddrs = append(m.ListenAddrs, make([]byte, postIndex-iNdEx)) - copy(m.ListenAddrs[len(m.ListenAddrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocols", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Protocols = append(m.Protocols, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObservedAddr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ObservedAddr = append(m.ObservedAddr[:0], dAtA[iNdEx:postIndex]...) - if m.ObservedAddr == nil { - m.ObservedAddr = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ProtocolVersion = &s - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AgentVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.AgentVersion = &s - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignedPeerRecord", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignedPeerRecord = append(m.SignedPeerRecord[:0], dAtA[iNdEx:postIndex]...) - if m.SignedPeerRecord == nil { - m.SignedPeerRecord = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIdentify(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIdentify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } +var ( + file_pb_identify_proto_rawDescOnce sync.Once + file_pb_identify_proto_rawDescData = file_pb_identify_proto_rawDesc +) - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipIdentify(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 { - if shift >= 64 { - return 0, ErrIntOverflowIdentify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIdentify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIdentify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } +func file_pb_identify_proto_rawDescGZIP() []byte { + file_pb_identify_proto_rawDescOnce.Do(func() { + file_pb_identify_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_identify_proto_rawDescData) + }) + return file_pb_identify_proto_rawDescData +} + +var file_pb_identify_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pb_identify_proto_goTypes = []interface{}{ + (*Identify)(nil), // 0: identify.pb.Identify +} +var file_pb_identify_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_pb_identify_proto_init() } +func file_pb_identify_proto_init() { + if File_pb_identify_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_identify_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Identify); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - if length < 0 { - return 0, ErrInvalidLengthIdentify - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupIdentify - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthIdentify - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_identify_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_identify_proto_goTypes, + DependencyIndexes: file_pb_identify_proto_depIdxs, + MessageInfos: file_pb_identify_proto_msgTypes, + }.Build() + File_pb_identify_proto = out.File + file_pb_identify_proto_rawDesc = nil + file_pb_identify_proto_goTypes = nil + file_pb_identify_proto_depIdxs = nil } - -var ( - ErrInvalidLengthIdentify = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIdentify = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupIdentify = fmt.Errorf("proto: unexpected end of group") -) diff --git a/p2p/protocol/internal/circuitv1-deprecated/pb/Makefile b/p2p/protocol/internal/circuitv1-deprecated/pb/Makefile deleted file mode 100644 index eb14b5768a..0000000000 --- a/p2p/protocol/internal/circuitv1-deprecated/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/p2p/protocol/internal/circuitv1-deprecated/pb/relay.pb.go b/p2p/protocol/internal/circuitv1-deprecated/pb/relay.pb.go index 66703f15aa..e71263ca07 100644 --- a/p2p/protocol/internal/circuitv1-deprecated/pb/relay.pb.go +++ b/p2p/protocol/internal/circuitv1-deprecated/pb/relay.pb.go @@ -1,27 +1,24 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: relay.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/relay.proto -package relay_pb +package pb import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type CircuitRelay_Status int32 @@ -44,43 +41,45 @@ const ( CircuitRelay_MALFORMED_MESSAGE CircuitRelay_Status = 400 ) -var CircuitRelay_Status_name = map[int32]string{ - 100: "SUCCESS", - 220: "HOP_SRC_ADDR_TOO_LONG", - 221: "HOP_DST_ADDR_TOO_LONG", - 250: "HOP_SRC_MULTIADDR_INVALID", - 251: "HOP_DST_MULTIADDR_INVALID", - 260: "HOP_NO_CONN_TO_DST", - 261: "HOP_CANT_DIAL_DST", - 262: "HOP_CANT_OPEN_DST_STREAM", - 270: "HOP_CANT_SPEAK_RELAY", - 280: "HOP_CANT_RELAY_TO_SELF", - 320: "STOP_SRC_ADDR_TOO_LONG", - 321: "STOP_DST_ADDR_TOO_LONG", - 350: "STOP_SRC_MULTIADDR_INVALID", - 351: "STOP_DST_MULTIADDR_INVALID", - 390: "STOP_RELAY_REFUSED", - 400: "MALFORMED_MESSAGE", -} - -var CircuitRelay_Status_value = map[string]int32{ - "SUCCESS": 100, - "HOP_SRC_ADDR_TOO_LONG": 220, - "HOP_DST_ADDR_TOO_LONG": 221, - "HOP_SRC_MULTIADDR_INVALID": 250, - "HOP_DST_MULTIADDR_INVALID": 251, - "HOP_NO_CONN_TO_DST": 260, - "HOP_CANT_DIAL_DST": 261, - "HOP_CANT_OPEN_DST_STREAM": 262, - "HOP_CANT_SPEAK_RELAY": 270, - "HOP_CANT_RELAY_TO_SELF": 280, - "STOP_SRC_ADDR_TOO_LONG": 320, - "STOP_DST_ADDR_TOO_LONG": 321, - "STOP_SRC_MULTIADDR_INVALID": 350, - "STOP_DST_MULTIADDR_INVALID": 351, - "STOP_RELAY_REFUSED": 390, - "MALFORMED_MESSAGE": 400, -} +// Enum value maps for CircuitRelay_Status. +var ( + CircuitRelay_Status_name = map[int32]string{ + 100: "SUCCESS", + 220: "HOP_SRC_ADDR_TOO_LONG", + 221: "HOP_DST_ADDR_TOO_LONG", + 250: "HOP_SRC_MULTIADDR_INVALID", + 251: "HOP_DST_MULTIADDR_INVALID", + 260: "HOP_NO_CONN_TO_DST", + 261: "HOP_CANT_DIAL_DST", + 262: "HOP_CANT_OPEN_DST_STREAM", + 270: "HOP_CANT_SPEAK_RELAY", + 280: "HOP_CANT_RELAY_TO_SELF", + 320: "STOP_SRC_ADDR_TOO_LONG", + 321: "STOP_DST_ADDR_TOO_LONG", + 350: "STOP_SRC_MULTIADDR_INVALID", + 351: "STOP_DST_MULTIADDR_INVALID", + 390: "STOP_RELAY_REFUSED", + 400: "MALFORMED_MESSAGE", + } + CircuitRelay_Status_value = map[string]int32{ + "SUCCESS": 100, + "HOP_SRC_ADDR_TOO_LONG": 220, + "HOP_DST_ADDR_TOO_LONG": 221, + "HOP_SRC_MULTIADDR_INVALID": 250, + "HOP_DST_MULTIADDR_INVALID": 251, + "HOP_NO_CONN_TO_DST": 260, + "HOP_CANT_DIAL_DST": 261, + "HOP_CANT_OPEN_DST_STREAM": 262, + "HOP_CANT_SPEAK_RELAY": 270, + "HOP_CANT_RELAY_TO_SELF": 280, + "STOP_SRC_ADDR_TOO_LONG": 320, + "STOP_DST_ADDR_TOO_LONG": 321, + "STOP_SRC_MULTIADDR_INVALID": 350, + "STOP_DST_MULTIADDR_INVALID": 351, + "STOP_RELAY_REFUSED": 390, + "MALFORMED_MESSAGE": 400, + } +) func (x CircuitRelay_Status) Enum() *CircuitRelay_Status { p := new(CircuitRelay_Status) @@ -89,20 +88,34 @@ func (x CircuitRelay_Status) Enum() *CircuitRelay_Status { } func (x CircuitRelay_Status) String() string { - return proto.EnumName(CircuitRelay_Status_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CircuitRelay_Status) Descriptor() protoreflect.EnumDescriptor { + return file_pb_relay_proto_enumTypes[0].Descriptor() +} + +func (CircuitRelay_Status) Type() protoreflect.EnumType { + return &file_pb_relay_proto_enumTypes[0] +} + +func (x CircuitRelay_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } -func (x *CircuitRelay_Status) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CircuitRelay_Status_value, data, "CircuitRelay_Status") +// Deprecated: Do not use. +func (x *CircuitRelay_Status) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = CircuitRelay_Status(value) + *x = CircuitRelay_Status(num) return nil } +// Deprecated: Use CircuitRelay_Status.Descriptor instead. func (CircuitRelay_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9f69a7d5a802d584, []int{0, 0} + return file_pb_relay_proto_rawDescGZIP(), []int{0, 0} } type CircuitRelay_Type int32 @@ -114,19 +127,21 @@ const ( CircuitRelay_CAN_HOP CircuitRelay_Type = 4 ) -var CircuitRelay_Type_name = map[int32]string{ - 1: "HOP", - 2: "STOP", - 3: "STATUS", - 4: "CAN_HOP", -} - -var CircuitRelay_Type_value = map[string]int32{ - "HOP": 1, - "STOP": 2, - "STATUS": 3, - "CAN_HOP": 4, -} +// Enum value maps for CircuitRelay_Type. +var ( + CircuitRelay_Type_name = map[int32]string{ + 1: "HOP", + 2: "STOP", + 3: "STATUS", + 4: "CAN_HOP", + } + CircuitRelay_Type_value = map[string]int32{ + "HOP": 1, + "STOP": 2, + "STATUS": 3, + "CAN_HOP": 4, + } +) func (x CircuitRelay_Type) Enum() *CircuitRelay_Type { p := new(CircuitRelay_Type) @@ -135,734 +150,298 @@ func (x CircuitRelay_Type) Enum() *CircuitRelay_Type { } func (x CircuitRelay_Type) String() string { - return proto.EnumName(CircuitRelay_Type_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (x *CircuitRelay_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CircuitRelay_Type_value, data, "CircuitRelay_Type") +func (CircuitRelay_Type) Descriptor() protoreflect.EnumDescriptor { + return file_pb_relay_proto_enumTypes[1].Descriptor() +} + +func (CircuitRelay_Type) Type() protoreflect.EnumType { + return &file_pb_relay_proto_enumTypes[1] +} + +func (x CircuitRelay_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *CircuitRelay_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = CircuitRelay_Type(value) + *x = CircuitRelay_Type(num) return nil } +// Deprecated: Use CircuitRelay_Type.Descriptor instead. func (CircuitRelay_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9f69a7d5a802d584, []int{0, 1} + return file_pb_relay_proto_rawDescGZIP(), []int{0, 1} } type CircuitRelay struct { - Type *CircuitRelay_Type `protobuf:"varint,1,opt,name=type,enum=relay.pb.CircuitRelay_Type" json:"type,omitempty"` - SrcPeer *CircuitRelay_Peer `protobuf:"bytes,2,opt,name=srcPeer" json:"srcPeer,omitempty"` - DstPeer *CircuitRelay_Peer `protobuf:"bytes,3,opt,name=dstPeer" json:"dstPeer,omitempty"` - Code *CircuitRelay_Status `protobuf:"varint,4,opt,name=code,enum=relay.pb.CircuitRelay_Status" json:"code,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CircuitRelay) Reset() { *m = CircuitRelay{} } -func (m *CircuitRelay) String() string { return proto.CompactTextString(m) } -func (*CircuitRelay) ProtoMessage() {} -func (*CircuitRelay) Descriptor() ([]byte, []int) { - return fileDescriptor_9f69a7d5a802d584, []int{0} -} -func (m *CircuitRelay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CircuitRelay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CircuitRelay.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CircuitRelay) XXX_Merge(src proto.Message) { - xxx_messageInfo_CircuitRelay.Merge(m, src) -} -func (m *CircuitRelay) XXX_Size() int { - return m.Size() -} -func (m *CircuitRelay) XXX_DiscardUnknown() { - xxx_messageInfo_CircuitRelay.DiscardUnknown(m) -} - -var xxx_messageInfo_CircuitRelay proto.InternalMessageInfo + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *CircuitRelay) GetType() CircuitRelay_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return CircuitRelay_HOP + Type *CircuitRelay_Type `protobuf:"varint,1,opt,name=type,enum=relay.pb.CircuitRelay_Type" json:"type,omitempty"` // Type of the message + SrcPeer *CircuitRelay_Peer `protobuf:"bytes,2,opt,name=srcPeer" json:"srcPeer,omitempty"` // srcPeer and dstPeer are used when Type is HOP or STOP + DstPeer *CircuitRelay_Peer `protobuf:"bytes,3,opt,name=dstPeer" json:"dstPeer,omitempty"` + Code *CircuitRelay_Status `protobuf:"varint,4,opt,name=code,enum=relay.pb.CircuitRelay_Status" json:"code,omitempty"` // Status code, used when Type is STATUS } -func (m *CircuitRelay) GetSrcPeer() *CircuitRelay_Peer { - if m != nil { - return m.SrcPeer +func (x *CircuitRelay) Reset() { + *x = CircuitRelay{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_relay_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -func (m *CircuitRelay) GetDstPeer() *CircuitRelay_Peer { - if m != nil { - return m.DstPeer - } - return nil +func (x *CircuitRelay) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CircuitRelay) GetCode() CircuitRelay_Status { - if m != nil && m.Code != nil { - return *m.Code +func (*CircuitRelay) ProtoMessage() {} + +func (x *CircuitRelay) ProtoReflect() protoreflect.Message { + mi := &file_pb_relay_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return CircuitRelay_SUCCESS + return mi.MessageOf(x) } -type CircuitRelay_Peer struct { - Id []byte `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` - Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use CircuitRelay.ProtoReflect.Descriptor instead. +func (*CircuitRelay) Descriptor() ([]byte, []int) { + return file_pb_relay_proto_rawDescGZIP(), []int{0} } -func (m *CircuitRelay_Peer) Reset() { *m = CircuitRelay_Peer{} } -func (m *CircuitRelay_Peer) String() string { return proto.CompactTextString(m) } -func (*CircuitRelay_Peer) ProtoMessage() {} -func (*CircuitRelay_Peer) Descriptor() ([]byte, []int) { - return fileDescriptor_9f69a7d5a802d584, []int{0, 0} -} -func (m *CircuitRelay_Peer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CircuitRelay_Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CircuitRelay_Peer.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *CircuitRelay) GetType() CircuitRelay_Type { + if x != nil && x.Type != nil { + return *x.Type } -} -func (m *CircuitRelay_Peer) XXX_Merge(src proto.Message) { - xxx_messageInfo_CircuitRelay_Peer.Merge(m, src) -} -func (m *CircuitRelay_Peer) XXX_Size() int { - return m.Size() -} -func (m *CircuitRelay_Peer) XXX_DiscardUnknown() { - xxx_messageInfo_CircuitRelay_Peer.DiscardUnknown(m) + return CircuitRelay_HOP } -var xxx_messageInfo_CircuitRelay_Peer proto.InternalMessageInfo - -func (m *CircuitRelay_Peer) GetId() []byte { - if m != nil { - return m.Id +func (x *CircuitRelay) GetSrcPeer() *CircuitRelay_Peer { + if x != nil { + return x.SrcPeer } return nil } -func (m *CircuitRelay_Peer) GetAddrs() [][]byte { - if m != nil { - return m.Addrs +func (x *CircuitRelay) GetDstPeer() *CircuitRelay_Peer { + if x != nil { + return x.DstPeer } return nil } -func init() { - proto.RegisterEnum("relay.pb.CircuitRelay_Status", CircuitRelay_Status_name, CircuitRelay_Status_value) - proto.RegisterEnum("relay.pb.CircuitRelay_Type", CircuitRelay_Type_name, CircuitRelay_Type_value) - proto.RegisterType((*CircuitRelay)(nil), "relay.pb.CircuitRelay") - proto.RegisterType((*CircuitRelay_Peer)(nil), "relay.pb.CircuitRelay.Peer") -} - -func init() { proto.RegisterFile("relay.proto", fileDescriptor_9f69a7d5a802d584) } - -var fileDescriptor_9f69a7d5a802d584 = []byte{ - // 473 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6f, 0xd3, 0x3e, - 0x18, 0xc7, 0x65, 0x27, 0xbf, 0x76, 0x7a, 0x5a, 0x4d, 0xfe, 0x59, 0x63, 0x64, 0x9d, 0x56, 0xaa, - 0x9e, 0x7a, 0x40, 0x45, 0x4c, 0xe2, 0x05, 0x98, 0xc4, 0xdd, 0x2a, 0xd2, 0x38, 0xb2, 0x5d, 0x24, - 0x4e, 0x56, 0x69, 0x72, 0xa8, 0x84, 0xd4, 0x2a, 0xcd, 0x0e, 0xbd, 0xc3, 0xb8, 0x21, 0x8e, 0xbc, - 0x1c, 0xe0, 0xc4, 0x91, 0x17, 0xc0, 0x3f, 0xf5, 0x65, 0xc0, 0x05, 0xd9, 0x5d, 0x33, 0x44, 0x37, - 0x89, 0xa3, 0x9f, 0xef, 0xe7, 0xe3, 0x3c, 0xf9, 0x26, 0xd0, 0x28, 0xf2, 0x17, 0x93, 0x55, 0x7f, - 0x51, 0xcc, 0xcb, 0x39, 0xdd, 0xbb, 0x3a, 0x3c, 0xef, 0xbe, 0xae, 0x41, 0x33, 0x9c, 0x15, 0xd3, - 0x8b, 0x59, 0x29, 0xed, 0x8c, 0x3e, 0x00, 0xbf, 0x5c, 0x2d, 0xf2, 0x00, 0x75, 0x50, 0x6f, 0xff, - 0xf4, 0xb8, 0xbf, 0x25, 0xfb, 0x7f, 0x52, 0x7d, 0xbd, 0x5a, 0xe4, 0xd2, 0x81, 0xf4, 0x11, 0xd4, - 0x97, 0xc5, 0x34, 0xcd, 0xf3, 0x22, 0xc0, 0x1d, 0xd4, 0x6b, 0xdc, 0xea, 0x58, 0x44, 0x6e, 0x59, - 0xab, 0x65, 0xcb, 0xd2, 0x69, 0xde, 0x3f, 0x68, 0x57, 0x2c, 0x7d, 0x08, 0xfe, 0x74, 0x9e, 0xe5, - 0x81, 0xef, 0xd6, 0x3b, 0xb9, 0xc5, 0x51, 0xe5, 0xa4, 0xbc, 0x58, 0x4a, 0x87, 0xb6, 0xee, 0x83, - 0xef, 0xd4, 0x7d, 0xc0, 0xb3, 0x2c, 0x40, 0x1d, 0xdc, 0x6b, 0x4a, 0x3c, 0xcb, 0xe8, 0x01, 0xfc, - 0x37, 0xc9, 0xb2, 0x62, 0x19, 0xe0, 0x8e, 0xd7, 0x6b, 0xca, 0xcd, 0xa1, 0xfb, 0xd1, 0x83, 0xda, - 0x46, 0xa7, 0x0d, 0xa8, 0xab, 0x71, 0x18, 0x72, 0xa5, 0x48, 0x46, 0x5b, 0x70, 0xe7, 0x5c, 0xa4, - 0x46, 0xc9, 0xd0, 0xb0, 0x28, 0x92, 0x46, 0x0b, 0x61, 0x62, 0x91, 0x9c, 0x91, 0x2f, 0x68, 0x9b, - 0x45, 0x4a, 0xff, 0x95, 0x7d, 0x45, 0xb4, 0x0d, 0x47, 0x5b, 0x6f, 0x34, 0x8e, 0xf5, 0xd0, 0x01, - 0xc3, 0xe4, 0x29, 0x8b, 0x87, 0x11, 0xf9, 0x59, 0xe5, 0xd6, 0xdd, 0xcd, 0x7f, 0x21, 0x7a, 0x17, - 0xa8, 0xcd, 0x13, 0x61, 0x42, 0x91, 0x24, 0x46, 0x0b, 0x8b, 0x92, 0x97, 0x98, 0x1e, 0xc2, 0xff, - 0x36, 0x08, 0x59, 0xa2, 0x4d, 0x34, 0x64, 0xb1, 0x9b, 0xbf, 0xc2, 0xf4, 0x04, 0x82, 0x6a, 0x2e, - 0x52, 0x9e, 0xb8, 0xab, 0x95, 0x96, 0x9c, 0x8d, 0xc8, 0x25, 0xa6, 0x47, 0x70, 0x50, 0xc5, 0x2a, - 0xe5, 0xec, 0x89, 0x91, 0x3c, 0x66, 0xcf, 0xc8, 0x1b, 0x4c, 0x8f, 0xe1, 0xb0, 0x8a, 0xdc, 0xd0, - 0x3e, 0x4d, 0xf1, 0x78, 0x40, 0xde, 0xb9, 0x50, 0xe9, 0x1b, 0x0b, 0x78, 0x7f, 0x1d, 0xee, 0x36, - 0xf0, 0x01, 0xd3, 0x7b, 0xd0, 0xaa, 0xcc, 0xdd, 0x57, 0xfc, 0x76, 0x0d, 0xdc, 0xdc, 0xc1, 0x77, - 0x6c, 0x3b, 0x70, 0xc0, 0x66, 0x29, 0xc9, 0x07, 0x63, 0xc5, 0x23, 0x72, 0xe9, 0xd9, 0x0e, 0x46, - 0x2c, 0x1e, 0x08, 0x39, 0xe2, 0x91, 0x19, 0x71, 0xa5, 0xd8, 0x19, 0x27, 0x6f, 0xbd, 0xee, 0x29, - 0xf8, 0xf6, 0x0f, 0xa5, 0x75, 0xf0, 0xce, 0x45, 0x4a, 0x10, 0xdd, 0x03, 0xdf, 0xde, 0x40, 0x30, - 0x05, 0xa8, 0x29, 0xcd, 0xf4, 0x58, 0x11, 0xcf, 0x7e, 0xe0, 0x90, 0x25, 0xc6, 0x22, 0xfe, 0xe3, - 0xe6, 0xa7, 0x75, 0x1b, 0x7d, 0x5e, 0xb7, 0xd1, 0x8f, 0x75, 0x1b, 0xfd, 0x0e, 0x00, 0x00, 0xff, - 0xff, 0x6b, 0x22, 0x33, 0xbb, 0x2f, 0x03, 0x00, 0x00, -} - -func (m *CircuitRelay) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *CircuitRelay) GetCode() CircuitRelay_Status { + if x != nil && x.Code != nil { + return *x.Code } - return dAtA[:n], nil + return CircuitRelay_SUCCESS } -func (m *CircuitRelay) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +type CircuitRelay_Peer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *CircuitRelay) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Code != nil { - i = encodeVarintRelay(dAtA, i, uint64(*m.Code)) - i-- - dAtA[i] = 0x20 - } - if m.DstPeer != nil { - { - size, err := m.DstPeer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRelay(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.SrcPeer != nil { - { - size, err := m.SrcPeer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRelay(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Type != nil { - i = encodeVarintRelay(dAtA, i, uint64(*m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil + Id []byte `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` // peer id + Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` // peer's known addresses } -func (m *CircuitRelay_Peer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *CircuitRelay_Peer) Reset() { + *x = CircuitRelay_Peer{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_relay_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return dAtA[:n], nil } -func (m *CircuitRelay_Peer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *CircuitRelay_Peer) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CircuitRelay_Peer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Addrs) > 0 { - for iNdEx := len(m.Addrs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addrs[iNdEx]) - copy(dAtA[i:], m.Addrs[iNdEx]) - i = encodeVarintRelay(dAtA, i, uint64(len(m.Addrs[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Id == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") - } else { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintRelay(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintRelay(dAtA []byte, offset int, v uint64) int { - offset -= sovRelay(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *CircuitRelay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != nil { - n += 1 + sovRelay(uint64(*m.Type)) - } - if m.SrcPeer != nil { - l = m.SrcPeer.Size() - n += 1 + l + sovRelay(uint64(l)) - } - if m.DstPeer != nil { - l = m.DstPeer.Size() - n += 1 + l + sovRelay(uint64(l)) - } - if m.Code != nil { - n += 1 + sovRelay(uint64(*m.Code)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} +func (*CircuitRelay_Peer) ProtoMessage() {} -func (m *CircuitRelay_Peer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != nil { - l = len(m.Id) - n += 1 + l + sovRelay(uint64(l)) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - l = len(b) - n += 1 + l + sovRelay(uint64(l)) +func (x *CircuitRelay_Peer) ProtoReflect() protoreflect.Message { + mi := &file_pb_relay_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return mi.MessageOf(x) } -func sovRelay(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozRelay(x uint64) (n int) { - return sovRelay(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +// Deprecated: Use CircuitRelay_Peer.ProtoReflect.Descriptor instead. +func (*CircuitRelay_Peer) Descriptor() ([]byte, []int) { + return file_pb_relay_proto_rawDescGZIP(), []int{0, 0} } -func (m *CircuitRelay) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CircuitRelay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CircuitRelay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var v CircuitRelay_Type - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= CircuitRelay_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Type = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcPeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRelay - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRelay - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SrcPeer == nil { - m.SrcPeer = &CircuitRelay_Peer{} - } - if err := m.SrcPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DstPeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRelay - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRelay - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DstPeer == nil { - m.DstPeer = &CircuitRelay_Peer{} - } - if err := m.DstPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) - } - var v CircuitRelay_Status - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= CircuitRelay_Status(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Code = &v - default: - iNdEx = preIndex - skippy, err := skipRelay(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRelay - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRelay - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *CircuitRelay_Peer) GetId() []byte { + if x != nil { + return x.Id } return nil } -func (m *CircuitRelay_Peer) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Peer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Peer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRelay - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRelay - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRelay - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRelay - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, make([]byte, postIndex-iNdEx)) - copy(m.Addrs[len(m.Addrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRelay(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRelay - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRelay - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *CircuitRelay_Peer) GetAddrs() [][]byte { + if x != nil { + return x.Addrs } return nil } -func skipRelay(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 { - if shift >= 64 { - return 0, ErrIntOverflowRelay - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + +var File_pb_relay_proto protoreflect.FileDescriptor + +var file_pb_relay_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x70, 0x62, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x62, 0x22, 0x87, 0x06, 0x0a, 0x0c, 0x43, + 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x2f, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x07, + 0x73, 0x72, 0x63, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x07, 0x73, 0x72, 0x63, 0x50, + 0x65, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x07, 0x64, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x62, 0x2e, + 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x50, 0x65, 0x65, + 0x72, 0x52, 0x07, 0x64, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x1a, 0x2c, 0x0a, + 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, + 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0c, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x22, 0xc2, 0x03, 0x0a, 0x06, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, + 0x53, 0x10, 0x64, 0x12, 0x1a, 0x0a, 0x15, 0x48, 0x4f, 0x50, 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x41, + 0x44, 0x44, 0x52, 0x5f, 0x54, 0x4f, 0x4f, 0x5f, 0x4c, 0x4f, 0x4e, 0x47, 0x10, 0xdc, 0x01, 0x12, + 0x1a, 0x0a, 0x15, 0x48, 0x4f, 0x50, 0x5f, 0x44, 0x53, 0x54, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x5f, + 0x54, 0x4f, 0x4f, 0x5f, 0x4c, 0x4f, 0x4e, 0x47, 0x10, 0xdd, 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x48, + 0x4f, 0x50, 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x41, 0x44, 0x44, 0x52, + 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0xfa, 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x48, + 0x4f, 0x50, 0x5f, 0x44, 0x53, 0x54, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x41, 0x44, 0x44, 0x52, + 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0xfb, 0x01, 0x12, 0x17, 0x0a, 0x12, 0x48, + 0x4f, 0x50, 0x5f, 0x4e, 0x4f, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x5f, 0x54, 0x4f, 0x5f, 0x44, 0x53, + 0x54, 0x10, 0x84, 0x02, 0x12, 0x16, 0x0a, 0x11, 0x48, 0x4f, 0x50, 0x5f, 0x43, 0x41, 0x4e, 0x54, + 0x5f, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x44, 0x53, 0x54, 0x10, 0x85, 0x02, 0x12, 0x1d, 0x0a, 0x18, + 0x48, 0x4f, 0x50, 0x5f, 0x43, 0x41, 0x4e, 0x54, 0x5f, 0x4f, 0x50, 0x45, 0x4e, 0x5f, 0x44, 0x53, + 0x54, 0x5f, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4d, 0x10, 0x86, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x48, + 0x4f, 0x50, 0x5f, 0x43, 0x41, 0x4e, 0x54, 0x5f, 0x53, 0x50, 0x45, 0x41, 0x4b, 0x5f, 0x52, 0x45, + 0x4c, 0x41, 0x59, 0x10, 0x8e, 0x02, 0x12, 0x1b, 0x0a, 0x16, 0x48, 0x4f, 0x50, 0x5f, 0x43, 0x41, + 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x59, 0x5f, 0x54, 0x4f, 0x5f, 0x53, 0x45, 0x4c, 0x46, + 0x10, 0x98, 0x02, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x54, 0x4f, 0x50, 0x5f, 0x53, 0x52, 0x43, 0x5f, + 0x41, 0x44, 0x44, 0x52, 0x5f, 0x54, 0x4f, 0x4f, 0x5f, 0x4c, 0x4f, 0x4e, 0x47, 0x10, 0xc0, 0x02, + 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x54, 0x4f, 0x50, 0x5f, 0x44, 0x53, 0x54, 0x5f, 0x41, 0x44, 0x44, + 0x52, 0x5f, 0x54, 0x4f, 0x4f, 0x5f, 0x4c, 0x4f, 0x4e, 0x47, 0x10, 0xc1, 0x02, 0x12, 0x1f, 0x0a, + 0x1a, 0x53, 0x54, 0x4f, 0x50, 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x41, + 0x44, 0x44, 0x52, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0xde, 0x02, 0x12, 0x1f, + 0x0a, 0x1a, 0x53, 0x54, 0x4f, 0x50, 0x5f, 0x44, 0x53, 0x54, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, + 0x41, 0x44, 0x44, 0x52, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0xdf, 0x02, 0x12, + 0x17, 0x0a, 0x12, 0x53, 0x54, 0x4f, 0x50, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x59, 0x5f, 0x52, 0x45, + 0x46, 0x55, 0x53, 0x45, 0x44, 0x10, 0x86, 0x03, 0x12, 0x16, 0x0a, 0x11, 0x4d, 0x41, 0x4c, 0x46, + 0x4f, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x90, 0x03, + 0x22, 0x32, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x48, 0x4f, 0x50, 0x10, + 0x01, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54, 0x4f, 0x50, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x41, 0x4e, 0x5f, 0x48, + 0x4f, 0x50, 0x10, 0x04, +} + +var ( + file_pb_relay_proto_rawDescOnce sync.Once + file_pb_relay_proto_rawDescData = file_pb_relay_proto_rawDesc +) + +func file_pb_relay_proto_rawDescGZIP() []byte { + file_pb_relay_proto_rawDescOnce.Do(func() { + file_pb_relay_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_relay_proto_rawDescData) + }) + return file_pb_relay_proto_rawDescData +} + +var file_pb_relay_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_pb_relay_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_pb_relay_proto_goTypes = []interface{}{ + (CircuitRelay_Status)(0), // 0: relay.pb.CircuitRelay.Status + (CircuitRelay_Type)(0), // 1: relay.pb.CircuitRelay.Type + (*CircuitRelay)(nil), // 2: relay.pb.CircuitRelay + (*CircuitRelay_Peer)(nil), // 3: relay.pb.CircuitRelay.Peer +} +var file_pb_relay_proto_depIdxs = []int32{ + 1, // 0: relay.pb.CircuitRelay.type:type_name -> relay.pb.CircuitRelay.Type + 3, // 1: relay.pb.CircuitRelay.srcPeer:type_name -> relay.pb.CircuitRelay.Peer + 3, // 2: relay.pb.CircuitRelay.dstPeer:type_name -> relay.pb.CircuitRelay.Peer + 0, // 3: relay.pb.CircuitRelay.code:type_name -> relay.pb.CircuitRelay.Status + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_pb_relay_proto_init() } +func file_pb_relay_proto_init() { + if File_pb_relay_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_relay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CircuitRelay); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRelay - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRelay - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthRelay - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthRelay - } - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupRelay + file_pb_relay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CircuitRelay_Peer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_relay_proto_rawDesc, + NumEnums: 2, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_relay_proto_goTypes, + DependencyIndexes: file_pb_relay_proto_depIdxs, + EnumInfos: file_pb_relay_proto_enumTypes, + MessageInfos: file_pb_relay_proto_msgTypes, + }.Build() + File_pb_relay_proto = out.File + file_pb_relay_proto_rawDesc = nil + file_pb_relay_proto_goTypes = nil + file_pb_relay_proto_depIdxs = nil } - -var ( - ErrInvalidLengthRelay = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRelay = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupRelay = fmt.Errorf("proto: unexpected end of group") -) diff --git a/p2p/protocol/internal/circuitv1-deprecated/util.go b/p2p/protocol/internal/circuitv1-deprecated/util.go index 966d9c59ae..1e9ab5167a 100644 --- a/p2p/protocol/internal/circuitv1-deprecated/util.go +++ b/p2p/protocol/internal/circuitv1-deprecated/util.go @@ -4,18 +4,19 @@ import ( "errors" "io" - pb "github.com/libp2p/go-libp2p/p2p/protocol/internal/circuitv1-deprecated/pb" - "github.com/libp2p/go-libp2p/core/peer" + "github.com/libp2p/go-libp2p/p2p/protocol/internal/circuitv1-deprecated/pb" pool "github.com/libp2p/go-buffer-pool" "github.com/libp2p/go-msgio/protoio" - "github.com/gogo/protobuf/proto" ma "github.com/multiformats/go-multiaddr" "github.com/multiformats/go-varint" + "google.golang.org/protobuf/proto" ) +//go:generate protoc --proto_path=$PWD:$PWD/../../../.. --go_out=. --go_opt=Mpb/relay.proto=./pb pb/relay.proto + func peerToPeerInfo(p *pb.CircuitRelay_Peer) (peer.AddrInfo, error) { if p == nil { return peer.AddrInfo{}, errors.New("nil peer") @@ -67,7 +68,7 @@ type delimitedReader struct { buf []byte } -// The gogo protobuf NewDelimitedReader is buffered, which may eat up stream data. +// The protobuf NewDelimitedReader is buffered, which may eat up stream data. // So we need to implement a compatible delimited reader that reads unbuffered. // There is a slowdown from unbuffered reading: when reading the message // it can take multiple single byte Reads to read the length and another Read diff --git a/p2p/security/noise/handshake.go b/p2p/security/noise/handshake.go index 4dd481d67f..e1a18e9b67 100644 --- a/p2p/security/noise/handshake.go +++ b/p2p/security/noise/handshake.go @@ -15,11 +15,13 @@ import ( "github.com/libp2p/go-libp2p/p2p/security/noise/pb" "github.com/flynn/noise" - "github.com/gogo/protobuf/proto" pool "github.com/libp2p/go-buffer-pool" "github.com/minio/sha256-simd" + "google.golang.org/protobuf/proto" ) +//go:generate protoc --go_out=. --go_opt=Mpb/payload.proto=./pb pb/payload.proto + // payloadSigPrefix is prepended to our Noise static key before signing with // our libp2p identity key. const payloadSigPrefix = "noise-libp2p-static-key:" diff --git a/p2p/security/noise/pb/Makefile b/p2p/security/noise/pb/Makefile deleted file mode 100644 index 7cf8222f89..0000000000 --- a/p2p/security/noise/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(PWD):$(PWD)/../.. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/p2p/security/noise/pb/payload.pb.go b/p2p/security/noise/pb/payload.pb.go index fdebe4879d..2572d721e7 100644 --- a/p2p/security/noise/pb/payload.pb.go +++ b/p2p/security/noise/pb/payload.pb.go @@ -1,664 +1,239 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: payload.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: pb/payload.proto package pb import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type NoiseExtensions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + WebtransportCerthashes [][]byte `protobuf:"bytes,1,rep,name=webtransport_certhashes,json=webtransportCerthashes" json:"webtransport_certhashes,omitempty"` StreamMuxers []string `protobuf:"bytes,2,rep,name=stream_muxers,json=streamMuxers" json:"stream_muxers,omitempty"` } -func (m *NoiseExtensions) Reset() { *m = NoiseExtensions{} } -func (m *NoiseExtensions) String() string { return proto.CompactTextString(m) } -func (*NoiseExtensions) ProtoMessage() {} -func (*NoiseExtensions) Descriptor() ([]byte, []int) { - return fileDescriptor_678c914f1bee6d56, []int{0} -} -func (m *NoiseExtensions) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NoiseExtensions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NoiseExtensions.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NoiseExtensions) XXX_Merge(src proto.Message) { - xxx_messageInfo_NoiseExtensions.Merge(m, src) -} -func (m *NoiseExtensions) XXX_Size() int { - return m.Size() -} -func (m *NoiseExtensions) XXX_DiscardUnknown() { - xxx_messageInfo_NoiseExtensions.DiscardUnknown(m) -} - -var xxx_messageInfo_NoiseExtensions proto.InternalMessageInfo - -func (m *NoiseExtensions) GetWebtransportCerthashes() [][]byte { - if m != nil { - return m.WebtransportCerthashes +func (x *NoiseExtensions) Reset() { + *x = NoiseExtensions{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_payload_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -func (m *NoiseExtensions) GetStreamMuxers() []string { - if m != nil { - return m.StreamMuxers - } - return nil +func (x *NoiseExtensions) String() string { + return protoimpl.X.MessageStringOf(x) } -type NoiseHandshakePayload struct { - 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"` - Extensions *NoiseExtensions `protobuf:"bytes,4,opt,name=extensions" json:"extensions,omitempty"` -} +func (*NoiseExtensions) ProtoMessage() {} -func (m *NoiseHandshakePayload) Reset() { *m = NoiseHandshakePayload{} } -func (m *NoiseHandshakePayload) String() string { return proto.CompactTextString(m) } -func (*NoiseHandshakePayload) ProtoMessage() {} -func (*NoiseHandshakePayload) Descriptor() ([]byte, []int) { - return fileDescriptor_678c914f1bee6d56, []int{1} -} -func (m *NoiseHandshakePayload) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NoiseHandshakePayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NoiseHandshakePayload.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *NoiseExtensions) ProtoReflect() protoreflect.Message { + mi := &file_pb_payload_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *NoiseHandshakePayload) XXX_Merge(src proto.Message) { - xxx_messageInfo_NoiseHandshakePayload.Merge(m, src) -} -func (m *NoiseHandshakePayload) XXX_Size() int { - return m.Size() -} -func (m *NoiseHandshakePayload) XXX_DiscardUnknown() { - xxx_messageInfo_NoiseHandshakePayload.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_NoiseHandshakePayload proto.InternalMessageInfo - -func (m *NoiseHandshakePayload) GetIdentityKey() []byte { - if m != nil { - return m.IdentityKey - } - return nil +// Deprecated: Use NoiseExtensions.ProtoReflect.Descriptor instead. +func (*NoiseExtensions) Descriptor() ([]byte, []int) { + return file_pb_payload_proto_rawDescGZIP(), []int{0} } -func (m *NoiseHandshakePayload) GetIdentitySig() []byte { - if m != nil { - return m.IdentitySig +func (x *NoiseExtensions) GetWebtransportCerthashes() [][]byte { + if x != nil { + return x.WebtransportCerthashes } return nil } -func (m *NoiseHandshakePayload) GetExtensions() *NoiseExtensions { - if m != nil { - return m.Extensions +func (x *NoiseExtensions) GetStreamMuxers() []string { + if x != nil { + return x.StreamMuxers } return nil } -func init() { - proto.RegisterType((*NoiseExtensions)(nil), "pb.NoiseExtensions") - proto.RegisterType((*NoiseHandshakePayload)(nil), "pb.NoiseHandshakePayload") -} - -func init() { proto.RegisterFile("payload.proto", fileDescriptor_678c914f1bee6d56) } - -var fileDescriptor_678c914f1bee6d56 = []byte{ - // 251 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, 0xca, 0xe7, - 0xe2, 0xf7, 0xcb, 0xcf, 0x2c, 0x4e, 0x75, 0xad, 0x28, 0x49, 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x2b, - 0x16, 0x32, 0xe7, 0x12, 0x2f, 0x4f, 0x4d, 0x2a, 0x29, 0x4a, 0xcc, 0x2b, 0x2e, 0xc8, 0x2f, 0x2a, - 0x89, 0x4f, 0x4e, 0x2d, 0x2a, 0xc9, 0x48, 0x2c, 0xce, 0x48, 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd6, - 0xe0, 0x09, 0x12, 0x43, 0x96, 0x76, 0x86, 0xcb, 0x0a, 0x29, 0x73, 0xf1, 0x16, 0x97, 0x14, 0xa5, - 0x26, 0xe6, 0xc6, 0xe7, 0x96, 0x56, 0xa4, 0x16, 0x15, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x06, - 0xf1, 0x40, 0x04, 0x7d, 0xc1, 0x62, 0x4a, 0xf3, 0x18, 0xb9, 0x44, 0xc1, 0x36, 0x7a, 0x24, 0xe6, - 0xa5, 0x14, 0x67, 0x24, 0x66, 0xa7, 0x06, 0x40, 0x1c, 0x25, 0xa4, 0xce, 0xc5, 0x93, 0x99, 0x92, - 0x9a, 0x57, 0x92, 0x59, 0x52, 0x19, 0x9f, 0x9d, 0x5a, 0x29, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe3, - 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x37, 0x4c, 0xc6, 0x3b, 0xb5, 0x12, 0x45, 0x61, 0x71, - 0x66, 0xba, 0x04, 0x13, 0x36, 0x85, 0xc1, 0x99, 0xe9, 0x42, 0xc6, 0x5c, 0x5c, 0xa9, 0x70, 0x7f, - 0x49, 0xb0, 0x28, 0x30, 0x6a, 0x70, 0x1b, 0x09, 0xeb, 0x15, 0x24, 0xe9, 0xa1, 0x79, 0x39, 0x08, - 0x49, 0x99, 0x93, 0xc4, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, - 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x00, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x02, 0xdb, 0x23, 0xb3, 0x3f, 0x01, 0x00, 0x00, -} - -func (m *NoiseExtensions) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} +type NoiseHandshakePayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *NoiseExtensions) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + IdentityKey []byte `protobuf:"bytes,1,opt,name=identity_key,json=identityKey" json:"identity_key,omitempty"` + IdentitySig []byte `protobuf:"bytes,2,opt,name=identity_sig,json=identitySig" json:"identity_sig,omitempty"` + Extensions *NoiseExtensions `protobuf:"bytes,4,opt,name=extensions" json:"extensions,omitempty"` } -func (m *NoiseExtensions) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.StreamMuxers) > 0 { - for iNdEx := len(m.StreamMuxers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.StreamMuxers[iNdEx]) - copy(dAtA[i:], m.StreamMuxers[iNdEx]) - i = encodeVarintPayload(dAtA, i, uint64(len(m.StreamMuxers[iNdEx]))) - i-- - dAtA[i] = 0x12 - } +func (x *NoiseHandshakePayload) Reset() { + *x = NoiseHandshakePayload{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_payload_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - if len(m.WebtransportCerthashes) > 0 { - for iNdEx := len(m.WebtransportCerthashes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.WebtransportCerthashes[iNdEx]) - copy(dAtA[i:], m.WebtransportCerthashes[iNdEx]) - i = encodeVarintPayload(dAtA, i, uint64(len(m.WebtransportCerthashes[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil } -func (m *NoiseHandshakePayload) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (x *NoiseHandshakePayload) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NoiseHandshakePayload) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +func (*NoiseHandshakePayload) ProtoMessage() {} -func (m *NoiseHandshakePayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Extensions != nil { - { - size, err := m.Extensions.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPayload(dAtA, i, uint64(size)) +func (x *NoiseHandshakePayload) ProtoReflect() protoreflect.Message { + mi := &file_pb_payload_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - i-- - dAtA[i] = 0x22 - } - 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 + return ms } - if m.IdentityKey != nil { - i -= len(m.IdentityKey) - copy(dAtA[i:], m.IdentityKey) - i = encodeVarintPayload(dAtA, i, uint64(len(m.IdentityKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + return mi.MessageOf(x) } -func encodeVarintPayload(dAtA []byte, offset int, v uint64) int { - offset -= sovPayload(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *NoiseExtensions) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.WebtransportCerthashes) > 0 { - for _, b := range m.WebtransportCerthashes { - l = len(b) - n += 1 + l + sovPayload(uint64(l)) - } - } - if len(m.StreamMuxers) > 0 { - for _, s := range m.StreamMuxers { - l = len(s) - n += 1 + l + sovPayload(uint64(l)) - } - } - return n +// Deprecated: Use NoiseHandshakePayload.ProtoReflect.Descriptor instead. +func (*NoiseHandshakePayload) Descriptor() ([]byte, []int) { + return file_pb_payload_proto_rawDescGZIP(), []int{1} } -func (m *NoiseHandshakePayload) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.IdentityKey != nil { - l = len(m.IdentityKey) - n += 1 + l + sovPayload(uint64(l)) +func (x *NoiseHandshakePayload) GetIdentityKey() []byte { + if x != nil { + return x.IdentityKey } - if m.IdentitySig != nil { - l = len(m.IdentitySig) - n += 1 + l + sovPayload(uint64(l)) - } - if m.Extensions != nil { - l = m.Extensions.Size() - n += 1 + l + sovPayload(uint64(l)) - } - return n -} - -func sovPayload(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozPayload(x uint64) (n int) { - return sovPayload(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *NoiseExtensions) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayload - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NoiseExtensions: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NoiseExtensions: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WebtransportCerthashes", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayload - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPayload - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPayload - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WebtransportCerthashes = append(m.WebtransportCerthashes, make([]byte, postIndex-iNdEx)) - copy(m.WebtransportCerthashes[len(m.WebtransportCerthashes)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StreamMuxers", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayload - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPayload - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPayload - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StreamMuxers = append(m.StreamMuxers, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPayload(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *NoiseHandshakePayload) GetIdentitySig() []byte { + if x != nil { + return x.IdentitySig } return nil } -func (m *NoiseHandshakePayload) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayload - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NoiseHandshakePayload: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NoiseHandshakePayload: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IdentityKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayload - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPayload - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPayload - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IdentityKey = append(m.IdentityKey[:0], dAtA[iNdEx:postIndex]...) - if m.IdentityKey == nil { - m.IdentityKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IdentitySig", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayload - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPayload - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPayload - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IdentitySig = append(m.IdentitySig[:0], dAtA[iNdEx:postIndex]...) - if m.IdentitySig == nil { - m.IdentitySig = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Extensions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayload - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPayload - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPayload - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Extensions == nil { - m.Extensions = &NoiseExtensions{} - } - if err := m.Extensions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPayload(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *NoiseHandshakePayload) GetExtensions() *NoiseExtensions { + if x != nil { + return x.Extensions } return nil } -func skipPayload(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 { - if shift >= 64 { - return 0, ErrIntOverflowPayload - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPayload - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPayload - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthPayload - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPayload - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthPayload - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF + +var File_pb_payload_proto protoreflect.FileDescriptor + +var file_pb_payload_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x70, 0x62, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x6f, 0x0a, 0x0f, 0x4e, 0x6f, 0x69, 0x73, 0x65, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x17, 0x77, 0x65, 0x62, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x68, 0x61, + 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x16, 0x77, 0x65, 0x62, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x65, 0x72, 0x74, 0x68, 0x61, 0x73, 0x68, + 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x6d, 0x75, 0x78, + 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x4d, 0x75, 0x78, 0x65, 0x72, 0x73, 0x22, 0x92, 0x01, 0x0a, 0x15, 0x4e, 0x6f, 0x69, 0x73, + 0x65, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x5f, 0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x53, 0x69, 0x67, 0x12, 0x33, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x62, + 0x2e, 0x4e, 0x6f, 0x69, 0x73, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, } var ( - ErrInvalidLengthPayload = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPayload = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPayload = fmt.Errorf("proto: unexpected end of group") + file_pb_payload_proto_rawDescOnce sync.Once + file_pb_payload_proto_rawDescData = file_pb_payload_proto_rawDesc ) + +func file_pb_payload_proto_rawDescGZIP() []byte { + file_pb_payload_proto_rawDescOnce.Do(func() { + file_pb_payload_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_payload_proto_rawDescData) + }) + return file_pb_payload_proto_rawDescData +} + +var file_pb_payload_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_pb_payload_proto_goTypes = []interface{}{ + (*NoiseExtensions)(nil), // 0: pb.NoiseExtensions + (*NoiseHandshakePayload)(nil), // 1: pb.NoiseHandshakePayload +} +var file_pb_payload_proto_depIdxs = []int32{ + 0, // 0: pb.NoiseHandshakePayload.extensions:type_name -> pb.NoiseExtensions + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pb_payload_proto_init() } +func file_pb_payload_proto_init() { + if File_pb_payload_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_payload_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NoiseExtensions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_payload_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NoiseHandshakePayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_payload_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_payload_proto_goTypes, + DependencyIndexes: file_pb_payload_proto_depIdxs, + MessageInfos: file_pb_payload_proto_msgTypes, + }.Build() + File_pb_payload_proto = out.File + file_pb_payload_proto_rawDesc = nil + file_pb_payload_proto_goTypes = nil + file_pb_payload_proto_depIdxs = nil +}