mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-27 09:05:18 +00:00
960 lines
24 KiB
Go
960 lines
24 KiB
Go
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||
|
// source: dht.proto
|
||
|
|
||
|
package dht_pb
|
||
|
|
||
|
import (
|
||
|
fmt "fmt"
|
||
|
io "io"
|
||
|
math "math"
|
||
|
math_bits "math/bits"
|
||
|
|
||
|
_ "github.com/gogo/protobuf/gogoproto"
|
||
|
proto "github.com/gogo/protobuf/proto"
|
||
|
pb "github.com/libp2p/go-libp2p-record/pb"
|
||
|
)
|
||
|
|
||
|
// 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
|
||
|
|
||
|
type Message_MessageType int32
|
||
|
|
||
|
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
|
||
|
)
|
||
|
|
||
|
var Message_MessageType_name = map[int32]string{
|
||
|
0: "PUT_VALUE",
|
||
|
1: "GET_VALUE",
|
||
|
2: "ADD_PROVIDER",
|
||
|
3: "GET_PROVIDERS",
|
||
|
4: "FIND_NODE",
|
||
|
5: "PING",
|
||
|
}
|
||
|
|
||
|
var Message_MessageType_value = map[string]int32{
|
||
|
"PUT_VALUE": 0,
|
||
|
"GET_VALUE": 1,
|
||
|
"ADD_PROVIDER": 2,
|
||
|
"GET_PROVIDERS": 3,
|
||
|
"FIND_NODE": 4,
|
||
|
"PING": 5,
|
||
|
}
|
||
|
|
||
|
func (x Message_MessageType) String() string {
|
||
|
return proto.EnumName(Message_MessageType_name, int32(x))
|
||
|
}
|
||
|
|
||
|
func (Message_MessageType) EnumDescriptor() ([]byte, []int) {
|
||
|
return fileDescriptor_616a434b24c97ff4, []int{0, 0}
|
||
|
}
|
||
|
|
||
|
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
|
||
|
)
|
||
|
|
||
|
var Message_ConnectionType_name = map[int32]string{
|
||
|
0: "NOT_CONNECTED",
|
||
|
1: "CONNECTED",
|
||
|
2: "CAN_CONNECT",
|
||
|
3: "CANNOT_CONNECT",
|
||
|
}
|
||
|
|
||
|
var Message_ConnectionType_value = map[string]int32{
|
||
|
"NOT_CONNECTED": 0,
|
||
|
"CONNECTED": 1,
|
||
|
"CAN_CONNECT": 2,
|
||
|
"CANNOT_CONNECT": 3,
|
||
|
}
|
||
|
|
||
|
func (x Message_ConnectionType) String() string {
|
||
|
return proto.EnumName(Message_ConnectionType_name, int32(x))
|
||
|
}
|
||
|
|
||
|
func (Message_ConnectionType) EnumDescriptor() ([]byte, []int) {
|
||
|
return fileDescriptor_616a434b24c97ff4, []int{0, 1}
|
||
|
}
|
||
|
|
||
|
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.
|
||
|
ClusterLevelRaw int32 `protobuf:"varint,10,opt,name=clusterLevelRaw,proto3" json:"clusterLevelRaw,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=closerPeers,proto3" json:"closerPeers"`
|
||
|
// Used to return Providers
|
||
|
// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
|
||
|
ProviderPeers []Message_Peer `protobuf:"bytes,9,rep,name=providerPeers,proto3" json:"providerPeers"`
|
||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||
|
XXX_unrecognized []byte `json:"-"`
|
||
|
XXX_sizecache int32 `json:"-"`
|
||
|
}
|
||
|
|
||
|
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_616a434b24c97ff4, []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()
|
||
|
}
|
||
|
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 {
|
||
|
return m.Type
|
||
|
}
|
||
|
return Message_PUT_VALUE
|
||
|
}
|
||
|
|
||
|
func (m *Message) GetClusterLevelRaw() int32 {
|
||
|
if m != nil {
|
||
|
return m.ClusterLevelRaw
|
||
|
}
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
func (m *Message) GetKey() []byte {
|
||
|
if m != nil {
|
||
|
return m.Key
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *Message) GetRecord() *pb.Record {
|
||
|
if m != nil {
|
||
|
return m.Record
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *Message) GetCloserPeers() []Message_Peer {
|
||
|
if m != nil {
|
||
|
return m.CloserPeers
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *Message) GetProviderPeers() []Message_Peer {
|
||
|
if m != nil {
|
||
|
return m.ProviderPeers
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
type Message_Peer struct {
|
||
|
// ID of a given peer.
|
||
|
Id byteString `protobuf:"bytes,1,opt,name=id,proto3,customtype=byteString" json:"id"`
|
||
|
// 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"`
|
||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||
|
XXX_unrecognized []byte `json:"-"`
|
||
|
XXX_sizecache int32 `json:"-"`
|
||
|
}
|
||
|
|
||
|
func (m *Message_Peer) Reset() { *m = Message_Peer{} }
|
||
|
func (m *Message_Peer) String() string { return proto.CompactTextString(m) }
|
||
|
func (*Message_Peer) ProtoMessage() {}
|
||
|
func (*Message_Peer) Descriptor() ([]byte, []int) {
|
||
|
return fileDescriptor_616a434b24c97ff4, []int{0, 0}
|
||
|
}
|
||
|
func (m *Message_Peer) XXX_Unmarshal(b []byte) error {
|
||
|
return m.Unmarshal(b)
|
||
|
}
|
||
|
func (m *Message_Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||
|
if deterministic {
|
||
|
return xxx_messageInfo_Message_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 *Message_Peer) XXX_Merge(src proto.Message) {
|
||
|
xxx_messageInfo_Message_Peer.Merge(m, src)
|
||
|
}
|
||
|
func (m *Message_Peer) XXX_Size() int {
|
||
|
return m.Size()
|
||
|
}
|
||
|
func (m *Message_Peer) XXX_DiscardUnknown() {
|
||
|
xxx_messageInfo_Message_Peer.DiscardUnknown(m)
|
||
|
}
|
||
|
|
||
|
var xxx_messageInfo_Message_Peer proto.InternalMessageInfo
|
||
|
|
||
|
func (m *Message_Peer) GetAddrs() [][]byte {
|
||
|
if m != nil {
|
||
|
return m.Addrs
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *Message_Peer) GetConnection() Message_ConnectionType {
|
||
|
if m != nil {
|
||
|
return m.Connection
|
||
|
}
|
||
|
return Message_NOT_CONNECTED
|
||
|
}
|
||
|
|
||
|
func init() {
|
||
|
proto.RegisterEnum("dht.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value)
|
||
|
proto.RegisterEnum("dht.pb.Message_ConnectionType", Message_ConnectionType_name, Message_ConnectionType_value)
|
||
|
proto.RegisterType((*Message)(nil), "dht.pb.Message")
|
||
|
proto.RegisterType((*Message_Peer)(nil), "dht.pb.Message.Peer")
|
||
|
}
|
||
|
|
||
|
func init() { proto.RegisterFile("dht.proto", fileDescriptor_616a434b24c97ff4) }
|
||
|
|
||
|
var fileDescriptor_616a434b24c97ff4 = []byte{
|
||
|
// 469 bytes of a gzipped FileDescriptorProto
|
||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xb1, 0x6f, 0x9b, 0x40,
|
||
|
0x18, 0xc5, 0x73, 0x80, 0xdd, 0xf8, 0x03, 0x3b, 0xe4, 0x94, 0x01, 0xb9, 0x92, 0x83, 0x3c, 0xd1,
|
||
|
0xc1, 0x20, 0xd1, 0xb5, 0xaa, 0x6a, 0x03, 0x8d, 0x2c, 0xa5, 0xd8, 0xba, 0x38, 0xe9, 0x68, 0x19,
|
||
|
0xb8, 0x12, 0x54, 0xd7, 0x87, 0x00, 0xa7, 0xf2, 0xd6, 0x3f, 0x2f, 0x63, 0xe7, 0x0e, 0x51, 0xe5,
|
||
|
0xa9, 0x7f, 0x46, 0xc5, 0x11, 0x5a, 0xec, 0x25, 0x13, 0xef, 0x7d, 0xf7, 0x7e, 0xe2, 0xdd, 0xa7,
|
||
|
0x83, 0x4e, 0x74, 0x5f, 0x98, 0x69, 0xc6, 0x0a, 0x86, 0xdb, 0x5c, 0x06, 0x7d, 0x3b, 0x4e, 0x8a,
|
||
|
0xfb, 0x6d, 0x60, 0x86, 0xec, 0x9b, 0xb5, 0x4e, 0x82, 0xd4, 0x4e, 0xad, 0x98, 0x8d, 0x2a, 0x35,
|
||
|
0xca, 0x68, 0xc8, 0xb2, 0xc8, 0x4a, 0x03, 0xab, 0x52, 0x15, 0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 0x00, 0x00,
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
return dAtA[:n], nil
|
||
|
}
|
||
|
|
||
|
func (m *Message) MarshalTo(dAtA []byte) (int, error) {
|
||
|
size := m.Size()
|
||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||
|
}
|
||
|
|
||
|
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.ClusterLevelRaw != 0 {
|
||
|
i = encodeVarintDht(dAtA, i, uint64(m.ClusterLevelRaw))
|
||
|
i--
|
||
|
dAtA[i] = 0x50
|
||
|
}
|
||
|
if len(m.ProviderPeers) > 0 {
|
||
|
for iNdEx := len(m.ProviderPeers) - 1; iNdEx >= 0; iNdEx-- {
|
||
|
{
|
||
|
size, err := m.ProviderPeers[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||
|
if err != nil {
|
||
|
return 0, err
|
||
|
}
|
||
|
i -= size
|
||
|
i = encodeVarintDht(dAtA, i, uint64(size))
|
||
|
}
|
||
|
i--
|
||
|
dAtA[i] = 0x4a
|
||
|
}
|
||
|
}
|
||
|
if len(m.CloserPeers) > 0 {
|
||
|
for iNdEx := len(m.CloserPeers) - 1; iNdEx >= 0; iNdEx-- {
|
||
|
{
|
||
|
size, err := m.CloserPeers[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||
|
if err != nil {
|
||
|
return 0, err
|
||
|
}
|
||
|
i -= size
|
||
|
i = encodeVarintDht(dAtA, i, uint64(size))
|
||
|
}
|
||
|
i--
|
||
|
dAtA[i] = 0x42
|
||
|
}
|
||
|
}
|
||
|
if m.Record != nil {
|
||
|
{
|
||
|
size, err := m.Record.MarshalToSizedBuffer(dAtA[:i])
|
||
|
if err != nil {
|
||
|
return 0, err
|
||
|
}
|
||
|
i -= size
|
||
|
i = encodeVarintDht(dAtA, i, uint64(size))
|
||
|
}
|
||
|
i--
|
||
|
dAtA[i] = 0x1a
|
||
|
}
|
||
|
if len(m.Key) > 0 {
|
||
|
i -= len(m.Key)
|
||
|
copy(dAtA[i:], m.Key)
|
||
|
i = encodeVarintDht(dAtA, i, uint64(len(m.Key)))
|
||
|
i--
|
||
|
dAtA[i] = 0x12
|
||
|
}
|
||
|
if m.Type != 0 {
|
||
|
i = encodeVarintDht(dAtA, i, uint64(m.Type))
|
||
|
i--
|
||
|
dAtA[i] = 0x8
|
||
|
}
|
||
|
return len(dAtA) - i, nil
|
||
|
}
|
||
|
|
||
|
func (m *Message_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
|
||
|
}
|
||
|
return dAtA[:n], nil
|
||
|
}
|
||
|
|
||
|
func (m *Message_Peer) MarshalTo(dAtA []byte) (int, error) {
|
||
|
size := m.Size()
|
||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||
|
}
|
||
|
|
||
|
func (m *Message_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 m.Connection != 0 {
|
||
|
i = encodeVarintDht(dAtA, i, uint64(m.Connection))
|
||
|
i--
|
||
|
dAtA[i] = 0x18
|
||
|
}
|
||
|
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 = encodeVarintDht(dAtA, i, uint64(len(m.Addrs[iNdEx])))
|
||
|
i--
|
||
|
dAtA[i] = 0x12
|
||
|
}
|
||
|
}
|
||
|
{
|
||
|
size := m.Id.Size()
|
||
|
i -= size
|
||
|
if _, err := m.Id.MarshalTo(dAtA[i:]); err != nil {
|
||
|
return 0, err
|
||
|
}
|
||
|
i = encodeVarintDht(dAtA, i, uint64(size))
|
||
|
}
|
||
|
i--
|
||
|
dAtA[i] = 0xa
|
||
|
return len(dAtA) - i, nil
|
||
|
}
|
||
|
|
||
|
func encodeVarintDht(dAtA []byte, offset int, v uint64) int {
|
||
|
offset -= sovDht(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 != 0 {
|
||
|
n += 1 + sovDht(uint64(m.Type))
|
||
|
}
|
||
|
l = len(m.Key)
|
||
|
if l > 0 {
|
||
|
n += 1 + l + sovDht(uint64(l))
|
||
|
}
|
||
|
if m.Record != nil {
|
||
|
l = m.Record.Size()
|
||
|
n += 1 + l + sovDht(uint64(l))
|
||
|
}
|
||
|
if len(m.CloserPeers) > 0 {
|
||
|
for _, e := range m.CloserPeers {
|
||
|
l = e.Size()
|
||
|
n += 1 + l + sovDht(uint64(l))
|
||
|
}
|
||
|
}
|
||
|
if len(m.ProviderPeers) > 0 {
|
||
|
for _, e := range m.ProviderPeers {
|
||
|
l = e.Size()
|
||
|
n += 1 + l + sovDht(uint64(l))
|
||
|
}
|
||
|
}
|
||
|
if m.ClusterLevelRaw != 0 {
|
||
|
n += 1 + sovDht(uint64(m.ClusterLevelRaw))
|
||
|
}
|
||
|
if m.XXX_unrecognized != nil {
|
||
|
n += len(m.XXX_unrecognized)
|
||
|
}
|
||
|
return n
|
||
|
}
|
||
|
|
||
|
func (m *Message_Peer) Size() (n int) {
|
||
|
if m == nil {
|
||
|
return 0
|
||
|
}
|
||
|
var l int
|
||
|
_ = l
|
||
|
l = m.Id.Size()
|
||
|
n += 1 + l + sovDht(uint64(l))
|
||
|
if len(m.Addrs) > 0 {
|
||
|
for _, b := range m.Addrs {
|
||
|
l = len(b)
|
||
|
n += 1 + l + sovDht(uint64(l))
|
||
|
}
|
||
|
}
|
||
|
if m.Connection != 0 {
|
||
|
n += 1 + sovDht(uint64(m.Connection))
|
||
|
}
|
||
|
if m.XXX_unrecognized != nil {
|
||
|
n += len(m.XXX_unrecognized)
|
||
|
}
|
||
|
return n
|
||
|
}
|
||
|
|
||
|
func sovDht(x uint64) (n int) {
|
||
|
return (math_bits.Len64(x|1) + 6) / 7
|
||
|
}
|
||
|
func sozDht(x uint64) (n int) {
|
||
|
return sovDht(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||
|
}
|
||
|
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 ErrIntOverflowDht
|
||
|
}
|
||
|
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)
|
||
|
}
|
||
|
m.Type = 0
|
||
|
for shift := uint(0); ; shift += 7 {
|
||
|
if shift >= 64 {
|
||
|
return ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
m.Type |= Message_MessageType(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
case 2:
|
||
|
if wireType != 2 {
|
||
|
return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
|
||
|
}
|
||
|
var byteLen int
|
||
|
for shift := uint(0); ; shift += 7 {
|
||
|
if shift >= 64 {
|
||
|
return ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
byteLen |= int(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if byteLen < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
postIndex := iNdEx + byteLen
|
||
|
if postIndex < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
if postIndex > l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
|
||
|
if m.Key == nil {
|
||
|
m.Key = []byte{}
|
||
|
}
|
||
|
iNdEx = postIndex
|
||
|
case 3:
|
||
|
if wireType != 2 {
|
||
|
return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType)
|
||
|
}
|
||
|
var msglen int
|
||
|
for shift := uint(0); ; shift += 7 {
|
||
|
if shift >= 64 {
|
||
|
return ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
msglen |= int(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if msglen < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
postIndex := iNdEx + msglen
|
||
|
if postIndex < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
if postIndex > l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
if m.Record == nil {
|
||
|
m.Record = &pb.Record{}
|
||
|
}
|
||
|
if err := m.Record.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
iNdEx = postIndex
|
||
|
case 8:
|
||
|
if wireType != 2 {
|
||
|
return fmt.Errorf("proto: wrong wireType = %d for field CloserPeers", wireType)
|
||
|
}
|
||
|
var msglen int
|
||
|
for shift := uint(0); ; shift += 7 {
|
||
|
if shift >= 64 {
|
||
|
return ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
msglen |= int(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if msglen < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
postIndex := iNdEx + msglen
|
||
|
if postIndex < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
if postIndex > l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
m.CloserPeers = append(m.CloserPeers, Message_Peer{})
|
||
|
if err := m.CloserPeers[len(m.CloserPeers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
iNdEx = postIndex
|
||
|
case 9:
|
||
|
if wireType != 2 {
|
||
|
return fmt.Errorf("proto: wrong wireType = %d for field ProviderPeers", wireType)
|
||
|
}
|
||
|
var msglen int
|
||
|
for shift := uint(0); ; shift += 7 {
|
||
|
if shift >= 64 {
|
||
|
return ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
msglen |= int(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if msglen < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
postIndex := iNdEx + msglen
|
||
|
if postIndex < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
if postIndex > l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
m.ProviderPeers = append(m.ProviderPeers, Message_Peer{})
|
||
|
if err := m.ProviderPeers[len(m.ProviderPeers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
iNdEx = postIndex
|
||
|
case 10:
|
||
|
if wireType != 0 {
|
||
|
return fmt.Errorf("proto: wrong wireType = %d for field ClusterLevelRaw", wireType)
|
||
|
}
|
||
|
m.ClusterLevelRaw = 0
|
||
|
for shift := uint(0); ; shift += 7 {
|
||
|
if shift >= 64 {
|
||
|
return ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
m.ClusterLevelRaw |= int32(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
default:
|
||
|
iNdEx = preIndex
|
||
|
skippy, err := skipDht(dAtA[iNdEx:])
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
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 (m *Message_Peer) 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 ErrIntOverflowDht
|
||
|
}
|
||
|
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 ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
byteLen |= int(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if byteLen < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
postIndex := iNdEx + byteLen
|
||
|
if postIndex < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
if postIndex > l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
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 ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
byteLen |= int(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if byteLen < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
postIndex := iNdEx + byteLen
|
||
|
if postIndex < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
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 != 0 {
|
||
|
return fmt.Errorf("proto: wrong wireType = %d for field Connection", wireType)
|
||
|
}
|
||
|
m.Connection = 0
|
||
|
for shift := uint(0); ; shift += 7 {
|
||
|
if shift >= 64 {
|
||
|
return ErrIntOverflowDht
|
||
|
}
|
||
|
if iNdEx >= l {
|
||
|
return io.ErrUnexpectedEOF
|
||
|
}
|
||
|
b := dAtA[iNdEx]
|
||
|
iNdEx++
|
||
|
m.Connection |= Message_ConnectionType(b&0x7F) << shift
|
||
|
if b < 0x80 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
default:
|
||
|
iNdEx = preIndex
|
||
|
skippy, err := skipDht(dAtA[iNdEx:])
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||
|
return ErrInvalidLengthDht
|
||
|
}
|
||
|
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 skipDht(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, ErrIntOverflowDht
|
||
|
}
|
||
|
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, ErrIntOverflowDht
|
||
|
}
|
||
|
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, ErrIntOverflowDht
|
||
|
}
|
||
|
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, ErrInvalidLengthDht
|
||
|
}
|
||
|
iNdEx += length
|
||
|
case 3:
|
||
|
depth++
|
||
|
case 4:
|
||
|
if depth == 0 {
|
||
|
return 0, ErrUnexpectedEndOfGroupDht
|
||
|
}
|
||
|
depth--
|
||
|
case 5:
|
||
|
iNdEx += 4
|
||
|
default:
|
||
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||
|
}
|
||
|
if iNdEx < 0 {
|
||
|
return 0, ErrInvalidLengthDht
|
||
|
}
|
||
|
if depth == 0 {
|
||
|
return iNdEx, nil
|
||
|
}
|
||
|
}
|
||
|
return 0, io.ErrUnexpectedEOF
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
ErrInvalidLengthDht = fmt.Errorf("proto: negative length found during unmarshaling")
|
||
|
ErrIntOverflowDht = fmt.Errorf("proto: integer overflow")
|
||
|
ErrUnexpectedEndOfGroupDht = fmt.Errorf("proto: unexpected end of group")
|
||
|
)
|