// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.36.6
// 	protoc        v5.29.3
// source: p2p.proto

package p2p

import (
	lib "github.com/canopy-network/canopy/lib"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	anypb "google.golang.org/protobuf/types/known/anypb"
	reflect "reflect"
	sync "sync"
	unsafe "unsafe"
)

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)
)

// *****************************************************************************************************
// This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)
//
// Protobuf is a language-neutral, platform-neutral serialization format. It allows users
// to define objects in a way that’s both efficient to store and fast to transmit over the network.
// These definitions are compiled into code that *enables different systems and programming languages
// to communicate in a byte-perfect manner*
//
// To update these structures, make changes to the source .proto files, then recompile
// to regenerate this file.
// These auto-generated files are easily recognized by checking for a `.pb.go` ending
// *****************************************************************************************************
// _
// _
// _
// Enveloper is a generic wrapper over a proto.message for the P2P module to handle
// Envelopes are first used to wrap bytes into a Packet, Ping, or Pong
// Then later is used to wrap a Packet.bytes into proto.Message
type Envelope struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// payload: is a generic proto.message
	Payload       *anypb.Any `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Envelope) Reset() {
	*x = Envelope{}
	mi := &file_p2p_proto_msgTypes[0]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Envelope) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Envelope) ProtoMessage() {}

func (x *Envelope) ProtoReflect() protoreflect.Message {
	mi := &file_p2p_proto_msgTypes[0]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Envelope.ProtoReflect.Descriptor instead.
func (*Envelope) Descriptor() ([]byte, []int) {
	return file_p2p_proto_rawDescGZIP(), []int{0}
}

func (x *Envelope) GetPayload() *anypb.Any {
	if x != nil {
		return x.Payload
	}
	return nil
}

// A Packet is a part of a message (or the entire message) that is associated with a specific stream topic and includes an EOF signal
type Packet struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// stream_id: the identifier of the stream/topic that this packet belongs to, used for multiplexing
	StreamId lib.Topic `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3,enum=types.Topic" json:"streamID"` // @gotags: json:"streamID"
	// eof: indicates whether this is the last packet of the message (EOF = true) or if more packets will follow (EOF = false)
	Eof bool `protobuf:"varint,2,opt,name=eof,proto3" json:"eof,omitempty"`
	// bytes: the actual message data transferred in this packet. It could represent the entire message or just a part of it
	Bytes         []byte `protobuf:"bytes,3,opt,name=bytes,proto3" json:"bytes,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Packet) Reset() {
	*x = Packet{}
	mi := &file_p2p_proto_msgTypes[1]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Packet) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Packet) ProtoMessage() {}

func (x *Packet) ProtoReflect() protoreflect.Message {
	mi := &file_p2p_proto_msgTypes[1]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Packet.ProtoReflect.Descriptor instead.
func (*Packet) Descriptor() ([]byte, []int) {
	return file_p2p_proto_rawDescGZIP(), []int{1}
}

func (x *Packet) GetStreamId() lib.Topic {
	if x != nil {
		return x.StreamId
	}
	return lib.Topic(0)
}

func (x *Packet) GetEof() bool {
	if x != nil {
		return x.Eof
	}
	return false
}

func (x *Packet) GetBytes() []byte {
	if x != nil {
		return x.Bytes
	}
	return nil
}

// PeerBookRequest is a peer exchange request message that enables new peer discovery via swapping
type PeerBookRequestMessage struct {
	state         protoimpl.MessageState `protogen:"open.v1"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *PeerBookRequestMessage) Reset() {
	*x = PeerBookRequestMessage{}
	mi := &file_p2p_proto_msgTypes[2]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *PeerBookRequestMessage) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*PeerBookRequestMessage) ProtoMessage() {}

func (x *PeerBookRequestMessage) ProtoReflect() protoreflect.Message {
	mi := &file_p2p_proto_msgTypes[2]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use PeerBookRequestMessage.ProtoReflect.Descriptor instead.
func (*PeerBookRequestMessage) Descriptor() ([]byte, []int) {
	return file_p2p_proto_rawDescGZIP(), []int{2}
}

// PeerBookResponseMessage is a peer exchange response message sent back after receiving a PeerBookRequestMessage
// The peer will select some random peers from their PeerBook to reply with
type PeerBookResponseMessage struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// book: randomly selected peers to exchange with the requester peer
	Book          []*BookPeer `protobuf:"bytes,1,rep,name=book,proto3" json:"book,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *PeerBookResponseMessage) Reset() {
	*x = PeerBookResponseMessage{}
	mi := &file_p2p_proto_msgTypes[3]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *PeerBookResponseMessage) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*PeerBookResponseMessage) ProtoMessage() {}

func (x *PeerBookResponseMessage) ProtoReflect() protoreflect.Message {
	mi := &file_p2p_proto_msgTypes[3]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use PeerBookResponseMessage.ProtoReflect.Descriptor instead.
func (*PeerBookResponseMessage) Descriptor() ([]byte, []int) {
	return file_p2p_proto_rawDescGZIP(), []int{3}
}

func (x *PeerBookResponseMessage) GetBook() []*BookPeer {
	if x != nil {
		return x.Book
	}
	return nil
}

// BookPeer is the peer object held and saved in the peer book for persisted peer connectivity and exchange
// Peer or Address book: A collection of peers or network addresses that a node uses to discover and connect with other nodes in the network.
// This book helps nodes keep track of available peers for communication and maintaining network connectivity.
type BookPeer struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// address: is the peer address object that holds identification and metadata about the peer
	Address *lib.PeerAddress `protobuf:"bytes,1,opt,name=Address,proto3" json:"address"` // @gotags: json:"address"
	// consecutive_failed_dial: is a churn management counter that tracks the number of consecutive failures
	// enough consecutive fails, the BookPeer is evicted from the book
	ConsecutiveFailedDial int32 `protobuf:"varint,2,opt,name=consecutive_failed_dial,json=consecutiveFailedDial,proto3" json:"consecutiveFailedDial"` // @gotags: json:"consecutiveFailedDial"
	unknownFields         protoimpl.UnknownFields
	sizeCache             protoimpl.SizeCache
}

func (x *BookPeer) Reset() {
	*x = BookPeer{}
	mi := &file_p2p_proto_msgTypes[4]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *BookPeer) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*BookPeer) ProtoMessage() {}

func (x *BookPeer) ProtoReflect() protoreflect.Message {
	mi := &file_p2p_proto_msgTypes[4]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use BookPeer.ProtoReflect.Descriptor instead.
func (*BookPeer) Descriptor() ([]byte, []int) {
	return file_p2p_proto_rawDescGZIP(), []int{4}
}

func (x *BookPeer) GetAddress() *lib.PeerAddress {
	if x != nil {
		return x.Address
	}
	return nil
}

func (x *BookPeer) GetConsecutiveFailedDial() int32 {
	if x != nil {
		return x.ConsecutiveFailedDial
	}
	return 0
}

var File_p2p_proto protoreflect.FileDescriptor

const file_p2p_proto_rawDesc = "" +
	"\n" +
	"\tp2p.proto\x12\x05types\x1a\n" +
	"peer.proto\x1a\x19google/protobuf/any.proto\":\n" +
	"\bEnvelope\x12.\n" +
	"\apayload\x18\x01 \x01(\v2\x14.google.protobuf.AnyR\apayload\"[\n" +
	"\x06Packet\x12)\n" +
	"\tstream_id\x18\x01 \x01(\x0e2\f.types.TopicR\bstreamId\x12\x10\n" +
	"\x03eof\x18\x02 \x01(\bR\x03eof\x12\x14\n" +
	"\x05bytes\x18\x03 \x01(\fR\x05bytes\"\x18\n" +
	"\x16PeerBookRequestMessage\">\n" +
	"\x17PeerBookResponseMessage\x12#\n" +
	"\x04book\x18\x01 \x03(\v2\x0f.types.BookPeerR\x04book\"p\n" +
	"\bBookPeer\x12,\n" +
	"\aAddress\x18\x01 \x01(\v2\x12.types.PeerAddressR\aAddress\x126\n" +
	"\x17consecutive_failed_dial\x18\x02 \x01(\x05R\x15consecutiveFailedDialB&Z$github.com/canopy-network/canopy/p2pb\x06proto3"

var (
	file_p2p_proto_rawDescOnce sync.Once
	file_p2p_proto_rawDescData []byte
)

func file_p2p_proto_rawDescGZIP() []byte {
	file_p2p_proto_rawDescOnce.Do(func() {
		file_p2p_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_p2p_proto_rawDesc), len(file_p2p_proto_rawDesc)))
	})
	return file_p2p_proto_rawDescData
}

var file_p2p_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_p2p_proto_goTypes = []any{
	(*Envelope)(nil),                // 0: types.Envelope
	(*Packet)(nil),                  // 1: types.Packet
	(*PeerBookRequestMessage)(nil),  // 2: types.PeerBookRequestMessage
	(*PeerBookResponseMessage)(nil), // 3: types.PeerBookResponseMessage
	(*BookPeer)(nil),                // 4: types.BookPeer
	(*anypb.Any)(nil),               // 5: google.protobuf.Any
	(lib.Topic)(0),                  // 6: types.Topic
	(*lib.PeerAddress)(nil),         // 7: types.PeerAddress
}
var file_p2p_proto_depIdxs = []int32{
	5, // 0: types.Envelope.payload:type_name -> google.protobuf.Any
	6, // 1: types.Packet.stream_id:type_name -> types.Topic
	4, // 2: types.PeerBookResponseMessage.book:type_name -> types.BookPeer
	7, // 3: types.BookPeer.Address:type_name -> types.PeerAddress
	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_p2p_proto_init() }
func file_p2p_proto_init() {
	if File_p2p_proto != nil {
		return
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_p2p_proto_rawDesc), len(file_p2p_proto_rawDesc)),
			NumEnums:      0,
			NumMessages:   5,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_p2p_proto_goTypes,
		DependencyIndexes: file_p2p_proto_depIdxs,
		MessageInfos:      file_p2p_proto_msgTypes,
	}.Build()
	File_p2p_proto = out.File
	file_p2p_proto_goTypes = nil
	file_p2p_proto_depIdxs = nil
}
