Documentation ¶
Index ¶
- Variables
- type Message
- func (m *Message) CloserNodes() []kadt.PeerID
- func (m *Message) CloserPeersAddrInfos() []peer.AddrInfo
- func (m *Message) ContainsCloserPeer(pid peer.ID) bool
- func (*Message) Descriptor() ([]byte, []int)deprecated
- func (m *Message) ExpectResponse() bool
- func (x *Message) GetCloserPeers() []*Message_Peer
- func (x *Message) GetClusterLevelRaw() int32deprecated
- func (x *Message) GetKey() []byte
- func (x *Message) GetProviderPeers() []*Message_Peer
- func (x *Message) GetRecord() *pb.Record
- func (x *Message) GetType() Message_MessageType
- func (*Message) ProtoMessage()
- func (x *Message) ProtoReflect() protoreflect.Message
- func (m *Message) ProviderAddrInfos() []peer.AddrInfo
- func (x *Message) Reset()
- func (m *Message) Size() (n int)
- func (x *Message) String() string
- func (m *Message) Target() kadt.Key
- type Message_ConnectionType
- func (Message_ConnectionType) Descriptor() protoreflect.EnumDescriptor
- func (x Message_ConnectionType) Enum() *Message_ConnectionType
- func (Message_ConnectionType) EnumDescriptor() ([]byte, []int)deprecated
- func (x Message_ConnectionType) Number() protoreflect.EnumNumber
- func (x Message_ConnectionType) String() string
- func (Message_ConnectionType) Type() protoreflect.EnumType
- type Message_MessageType
- func (Message_MessageType) Descriptor() protoreflect.EnumDescriptor
- func (x Message_MessageType) Enum() *Message_MessageType
- func (Message_MessageType) EnumDescriptor() ([]byte, []int)deprecated
- func (x Message_MessageType) Number() protoreflect.EnumNumber
- func (x Message_MessageType) String() string
- func (Message_MessageType) Type() protoreflect.EnumType
- type Message_Peer
- func (m *Message_Peer) Addresses() []ma.Multiaddr
- func (*Message_Peer) Descriptor() ([]byte, []int)deprecated
- func (x *Message_Peer) GetAddrs() [][]byte
- func (x *Message_Peer) GetConnection() Message_ConnectionType
- func (x *Message_Peer) GetId() []byte
- func (*Message_Peer) ProtoMessage()
- func (x *Message_Peer) ProtoReflect() protoreflect.Message
- func (x *Message_Peer) Reset()
- func (m *Message_Peer) Size() (n int)
- func (x *Message_Peer) String() string
Constants ¶
This section is empty.
Variables ¶
var ( Message_MessageType_name = map[int32]string{ 0: "PUT_VALUE", 1: "GET_VALUE", 2: "ADD_PROVIDER", 3: "GET_PROVIDERS", 4: "FIND_NODE", 5: "PING", } Message_MessageType_value = map[string]int32{ "PUT_VALUE": 0, "GET_VALUE": 1, "ADD_PROVIDER": 2, "GET_PROVIDERS": 3, "FIND_NODE": 4, "PING": 5, } )
Enum value maps for Message_MessageType.
var ( Message_ConnectionType_name = map[int32]string{ 0: "NOT_CONNECTED", 1: "CONNECTED", 2: "CAN_CONNECT", 3: "CANNOT_CONNECT", } Message_ConnectionType_value = map[string]int32{ "NOT_CONNECTED": 0, "CONNECTED": 1, "CAN_CONNECT": 2, "CANNOT_CONNECT": 3, } )
Enum value maps for Message_ConnectionType.
var File_msg_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { // defines what type of message it is. Type Message_MessageType `protobuf:"varint,1,opt,name=type,proto3,enum=dht.pb.Message_MessageType" json:"type,omitempty"` // defines what coral cluster level this query/response belongs to. // in case we want to implement coral's cluster rings in the future. // // Deprecated: Marked as deprecated in msg.proto. ClusterLevelRaw int32 `protobuf:"varint,10,opt,name=cluster_level_raw,json=clusterLevelRaw,proto3" json:"cluster_level_raw,omitempty"` // Used to specify the key associated with this message. // PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // Used to return a value // PUT_VALUE, GET_VALUE Record *pb.Record `protobuf:"bytes,3,opt,name=record,proto3" json:"record,omitempty"` // Used to return peers closer to a key in a query // GET_VALUE, GET_PROVIDERS, FIND_NODE CloserPeers []*Message_Peer `protobuf:"bytes,8,rep,name=closer_peers,json=closerPeers,proto3" json:"closer_peers,omitempty"` // Used to return Providers // GET_VALUE, ADD_PROVIDER, GET_PROVIDERS ProviderPeers []*Message_Peer `protobuf:"bytes,9,rep,name=provider_peers,json=providerPeers,proto3" json:"provider_peers,omitempty"` // contains filtered or unexported fields }
Message is the top-level envelope for exchanging information with the DHT protocol.
func (*Message) CloserNodes ¶
func (*Message) CloserPeersAddrInfos ¶
CloserPeersAddrInfos returns the peer.AddrInfo's of the closer peers in this message.
func (*Message) ContainsCloserPeer ¶
ContainsCloserPeer returns true if the provided peer ID is among the list of closer peers contained in this message.
func (*Message) Descriptor
deprecated
func (*Message) ExpectResponse ¶
ExpectResponse returns true if we expect a response from the remote peer if we sent a message with the given type to them. For example, when a peer sends a PUT_VALUE message to another peer, that other peer won't respond with anything.
func (*Message) GetCloserPeers ¶
func (x *Message) GetCloserPeers() []*Message_Peer
func (*Message) GetClusterLevelRaw
deprecated
func (*Message) GetProviderPeers ¶
func (x *Message) GetProviderPeers() []*Message_Peer
func (*Message) GetType ¶
func (x *Message) GetType() Message_MessageType
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
func (*Message) ProviderAddrInfos ¶
ProviderAddrInfos returns the peer.AddrInfo's of the provider peers in this message.
type Message_ConnectionType ¶
type Message_ConnectionType int32
const ( // sender does not have a connection to peer, and no extra information (default) Message_NOT_CONNECTED Message_ConnectionType = 0 // sender has a live connection to peer Message_CONNECTED Message_ConnectionType = 1 // sender recently connected to peer Message_CAN_CONNECT Message_ConnectionType = 2 // sender recently tried to connect to peer repeatedly but failed to connect // ("try" here is loose, but this should signal "made strong effort, failed") Message_CANNOT_CONNECT Message_ConnectionType = 3 )
func (Message_ConnectionType) Descriptor ¶
func (Message_ConnectionType) Descriptor() protoreflect.EnumDescriptor
func (Message_ConnectionType) Enum ¶
func (x Message_ConnectionType) Enum() *Message_ConnectionType
func (Message_ConnectionType) EnumDescriptor
deprecated
func (Message_ConnectionType) EnumDescriptor() ([]byte, []int)
Deprecated: Use Message_ConnectionType.Descriptor instead.
func (Message_ConnectionType) Number ¶
func (x Message_ConnectionType) Number() protoreflect.EnumNumber
func (Message_ConnectionType) String ¶
func (x Message_ConnectionType) String() string
func (Message_ConnectionType) Type ¶
func (Message_ConnectionType) Type() protoreflect.EnumType
type Message_MessageType ¶
type Message_MessageType int32
MessageType represents the type of RPC being called. Based on the message type different fields of this message will be populated. The response of a message with a certain type will have the same type.
const ( Message_PUT_VALUE Message_MessageType = 0 Message_GET_VALUE Message_MessageType = 1 Message_ADD_PROVIDER Message_MessageType = 2 Message_GET_PROVIDERS Message_MessageType = 3 Message_FIND_NODE Message_MessageType = 4 Message_PING Message_MessageType = 5 )
func (Message_MessageType) Descriptor ¶
func (Message_MessageType) Descriptor() protoreflect.EnumDescriptor
func (Message_MessageType) Enum ¶
func (x Message_MessageType) Enum() *Message_MessageType
func (Message_MessageType) EnumDescriptor
deprecated
func (Message_MessageType) EnumDescriptor() ([]byte, []int)
Deprecated: Use Message_MessageType.Descriptor instead.
func (Message_MessageType) Number ¶
func (x Message_MessageType) Number() protoreflect.EnumNumber
func (Message_MessageType) String ¶
func (x Message_MessageType) String() string
func (Message_MessageType) Type ¶
func (Message_MessageType) Type() protoreflect.EnumType
type Message_Peer ¶
type Message_Peer struct { // ID of a given peer. Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // multiaddrs for a given peer Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs,proto3" json:"addrs,omitempty"` // used to signal the sender's connection capabilities to the peer Connection Message_ConnectionType `protobuf:"varint,3,opt,name=connection,proto3,enum=dht.pb.Message_ConnectionType" json:"connection,omitempty"` // contains filtered or unexported fields }
func FromAddrInfo ¶
func FromAddrInfo(p peer.AddrInfo) *Message_Peer
FromAddrInfo constructs a Message_Peer from the given peer.AddrInfo.
func (*Message_Peer) Addresses ¶
func (m *Message_Peer) Addresses() []ma.Multiaddr
Addresses returns the Multiaddresses associated with the Message_Peer entry
func (*Message_Peer) Descriptor
deprecated
func (*Message_Peer) Descriptor() ([]byte, []int)
Deprecated: Use Message_Peer.ProtoReflect.Descriptor instead.
func (*Message_Peer) GetAddrs ¶
func (x *Message_Peer) GetAddrs() [][]byte
func (*Message_Peer) GetConnection ¶
func (x *Message_Peer) GetConnection() Message_ConnectionType
func (*Message_Peer) GetId ¶
func (x *Message_Peer) GetId() []byte
func (*Message_Peer) ProtoMessage ¶
func (*Message_Peer) ProtoMessage()
func (*Message_Peer) ProtoReflect ¶
func (x *Message_Peer) ProtoReflect() protoreflect.Message
func (*Message_Peer) Reset ¶
func (x *Message_Peer) Reset()
func (*Message_Peer) Size ¶
func (m *Message_Peer) Size() (n int)
func (*Message_Peer) String ¶
func (x *Message_Peer) String() string