dht.pb.go 24.1 KB
Newer Older
1
// Code generated by protoc-gen-gogo. DO NOT EDIT.
2
// source: dht.proto
3

4
package dht_pb
5

Jakub Sztandera's avatar
Jakub Sztandera committed
6 7
import (
	fmt "fmt"
Steven Allen's avatar
Steven Allen committed
8
	_ "github.com/gogo/protobuf/gogoproto"
Jakub Sztandera's avatar
Jakub Sztandera committed
9 10 11 12
	proto "github.com/gogo/protobuf/proto"
	pb "github.com/libp2p/go-libp2p-record/pb"
	io "io"
	math "math"
Steven Allen's avatar
Steven Allen committed
13
	math_bits "math/bits"
Jakub Sztandera's avatar
Jakub Sztandera committed
14
)
15

16
// Reference imports to suppress errors if they are not otherwise used.
17
var _ = proto.Marshal
George Antoniadis's avatar
George Antoniadis committed
18
var _ = fmt.Errorf
19 20
var _ = math.Inf

21 22 23 24
// 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.
Steven Allen's avatar
Steven Allen committed
25
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
26

27
type Message_MessageType int32
28 29

const (
30 31 32 33 34 35
	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
36 37
)

38
var Message_MessageType_name = map[int32]string{
39 40
	0: "PUT_VALUE",
	1: "GET_VALUE",
41 42 43 44
	2: "ADD_PROVIDER",
	3: "GET_PROVIDERS",
	4: "FIND_NODE",
	5: "PING",
45
}
Jakub Sztandera's avatar
Jakub Sztandera committed
46

47
var Message_MessageType_value = map[string]int32{
48 49 50 51 52 53
	"PUT_VALUE":     0,
	"GET_VALUE":     1,
	"ADD_PROVIDER":  2,
	"GET_PROVIDERS": 3,
	"FIND_NODE":     4,
	"PING":          5,
54 55
}

56 57
func (x Message_MessageType) String() string {
	return proto.EnumName(Message_MessageType_name, int32(x))
58
}
Jakub Sztandera's avatar
Jakub Sztandera committed
59

60
func (Message_MessageType) EnumDescriptor() ([]byte, []int) {
Jakub Sztandera's avatar
Jakub Sztandera committed
61
	return fileDescriptor_616a434b24c97ff4, []int{0, 0}
62 63
}

64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
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",
}
Jakub Sztandera's avatar
Jakub Sztandera committed
84

85 86 87 88 89 90 91 92 93 94
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))
}
Jakub Sztandera's avatar
Jakub Sztandera committed
95

96
func (Message_ConnectionType) EnumDescriptor() ([]byte, []int) {
Jakub Sztandera's avatar
Jakub Sztandera committed
97
	return fileDescriptor_616a434b24c97ff4, []int{0, 1}
98 99
}

100 101
type Message struct {
	// defines what type of message it is.
102
	Type Message_MessageType `protobuf:"varint,1,opt,name=type,proto3,enum=dht.pb.Message_MessageType" json:"type,omitempty"`
103
	// defines what coral cluster level this query/response belongs to.
104
	// in case we want to implement coral's cluster rings in the future.
105
	ClusterLevelRaw int32 `protobuf:"varint,10,opt,name=clusterLevelRaw,proto3" json:"clusterLevelRaw,omitempty"`
106 107
	// Used to specify the key associated with this message.
	// PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
108
	Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
109 110
	// Used to return a value
	// PUT_VALUE, GET_VALUE
Jakub Sztandera's avatar
Jakub Sztandera committed
111
	Record *pb.Record `protobuf:"bytes,3,opt,name=record,proto3" json:"record,omitempty"`
112 113
	// Used to return peers closer to a key in a query
	// GET_VALUE, GET_PROVIDERS, FIND_NODE
Steven Allen's avatar
Steven Allen committed
114
	CloserPeers []Message_Peer `protobuf:"bytes,8,rep,name=closerPeers,proto3" json:"closerPeers"`
115 116
	// Used to return Providers
	// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
Steven Allen's avatar
Steven Allen committed
117 118 119 120
	ProviderPeers        []Message_Peer `protobuf:"bytes,9,rep,name=providerPeers,proto3" json:"providerPeers"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
121 122
}

George Antoniadis's avatar
George Antoniadis committed
123 124 125
func (m *Message) Reset()         { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage()    {}
126
func (*Message) Descriptor() ([]byte, []int) {
Jakub Sztandera's avatar
Jakub Sztandera committed
127
	return fileDescriptor_616a434b24c97ff4, []int{0}
128 129 130 131 132 133 134 135 136
}
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)]
Steven Allen's avatar
Steven Allen committed
137
		n, err := m.MarshalToSizedBuffer(b)
138 139 140 141 142 143
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
Jakub Sztandera's avatar
Jakub Sztandera committed
144 145
func (m *Message) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Message.Merge(m, src)
146 147 148 149 150 151 152 153 154
}
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
155 156

func (m *Message) GetType() Message_MessageType {
157 158
	if m != nil {
		return m.Type
159
	}
160
	return Message_PUT_VALUE
161 162
}

163
func (m *Message) GetClusterLevelRaw() int32 {
164 165
	if m != nil {
		return m.ClusterLevelRaw
166 167 168 169
	}
	return 0
}

170 171 172
func (m *Message) GetKey() []byte {
	if m != nil {
		return m.Key
173
	}
174
	return nil
175 176
}

177
func (m *Message) GetRecord() *pb.Record {
178
	if m != nil {
179
		return m.Record
180 181 182 183
	}
	return nil
}

Steven Allen's avatar
Steven Allen committed
184
func (m *Message) GetCloserPeers() []Message_Peer {
185 186
	if m != nil {
		return m.CloserPeers
187
	}
188
	return nil
189 190
}

Steven Allen's avatar
Steven Allen committed
191
func (m *Message) GetProviderPeers() []Message_Peer {
192
	if m != nil {
193
		return m.ProviderPeers
194 195 196 197
	}
	return nil
}

198
type Message_Peer struct {
199
	// ID of a given peer.
Steven Allen's avatar
Steven Allen committed
200
	Id byteString `protobuf:"bytes,1,opt,name=id,proto3,customtype=byteString" json:"id"`
201
	// multiaddrs for a given peer
Jakub Sztandera's avatar
Jakub Sztandera committed
202
	Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs,proto3" json:"addrs,omitempty"`
203
	// used to signal the sender's connection capabilities to the peer
204 205 206 207
	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:"-"`
208 209
}

George Antoniadis's avatar
George Antoniadis committed
210 211 212
func (m *Message_Peer) Reset()         { *m = Message_Peer{} }
func (m *Message_Peer) String() string { return proto.CompactTextString(m) }
func (*Message_Peer) ProtoMessage()    {}
213
func (*Message_Peer) Descriptor() ([]byte, []int) {
Jakub Sztandera's avatar
Jakub Sztandera committed
214
	return fileDescriptor_616a434b24c97ff4, []int{0, 0}
215 216 217 218 219 220 221 222 223
}
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)]
Steven Allen's avatar
Steven Allen committed
224
		n, err := m.MarshalToSizedBuffer(b)
225 226 227 228 229 230
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
Jakub Sztandera's avatar
Jakub Sztandera committed
231 232
func (m *Message_Peer) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Message_Peer.Merge(m, src)
233 234 235 236 237 238 239 240 241
}
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
242

243
func (m *Message_Peer) GetAddrs() [][]byte {
244 245
	if m != nil {
		return m.Addrs
246
	}
247 248 249 250
	return nil
}

func (m *Message_Peer) GetConnection() Message_ConnectionType {
251 252
	if m != nil {
		return m.Connection
253 254
	}
	return Message_NOT_CONNECTED
255 256
}

257
func init() {
258
	proto.RegisterEnum("dht.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value)
259
	proto.RegisterEnum("dht.pb.Message_ConnectionType", Message_ConnectionType_name, Message_ConnectionType_value)
Jakub Sztandera's avatar
Jakub Sztandera committed
260 261
	proto.RegisterType((*Message)(nil), "dht.pb.Message")
	proto.RegisterType((*Message_Peer)(nil), "dht.pb.Message.Peer")
262
}
Jakub Sztandera's avatar
Jakub Sztandera committed
263 264 265 266

func init() { proto.RegisterFile("dht.proto", fileDescriptor_616a434b24c97ff4) }

var fileDescriptor_616a434b24c97ff4 = []byte{
Steven Allen's avatar
Steven Allen committed
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
	// 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, 0xdb, 0x1f, 0x35, 0x98, 0x98, 0xc5,
	0xcc, 0xe2, 0xe3, 0x60, 0xfb, 0x85, 0x3b, 0x6e, 0xb8, 0xaa, 0xe2, 0xc3, 0x3f, 0x12, 0xbc, 0xfa,
	0x44, 0xf3, 0x7c, 0x15, 0x53, 0x6c, 0x81, 0x54, 0xec, 0x52, 0xaa, 0x21, 0x1d, 0x19, 0x3d, 0xfb,
	0xb5, 0x59, 0xb5, 0x30, 0x9f, 0x8f, 0xeb, 0xef, 0x62, 0x97, 0x52, 0xc2, 0x83, 0xd8, 0x80, 0xb3,
	0x70, 0xbd, 0xcd, 0x0b, 0x9a, 0x5d, 0xd3, 0x07, 0xba, 0x26, 0xab, 0xef, 0x1a, 0xe8, 0xc8, 0x68,
	0x91, 0xe3, 0x31, 0x56, 0x41, 0xfc, 0x4a, 0x77, 0x9a, 0xa0, 0x23, 0x43, 0x21, 0xa5, 0xc4, 0x6f,
	0xa0, 0x5d, 0xf5, 0xd6, 0x44, 0x1d, 0x19, 0xb2, 0x7d, 0x6e, 0xd6, 0xd7, 0x08, 0x4c, 0xc2, 0x15,
	0x79, 0x0e, 0xe0, 0x77, 0x20, 0x87, 0x6b, 0x96, 0xd3, 0x6c, 0x4e, 0x69, 0x96, 0x6b, 0xa7, 0xba,
	0x68, 0xc8, 0xf6, 0xc5, 0x71, 0xbd, 0xf2, 0x70, 0x22, 0x3d, 0x3e, 0x5d, 0x9e, 0x90, 0x66, 0x1c,
	0x7f, 0x80, 0x6e, 0x9a, 0xb1, 0x87, 0x24, 0xaa, 0xf9, 0xce, 0x8b, 0xfc, 0x21, 0xd0, 0xff, 0x81,
	0x40, 0x2a, 0x15, 0x1e, 0x82, 0x90, 0x44, 0x7c, 0x3d, 0xca, 0x04, 0x97, 0xc9, 0x5f, 0x4f, 0x97,
	0x10, 0xec, 0x0a, 0x7a, 0x53, 0x64, 0xc9, 0x26, 0x26, 0x42, 0x12, 0xe1, 0x0b, 0x68, 0xad, 0xa2,
	0x28, 0xcb, 0x35, 0x41, 0x17, 0x0d, 0x85, 0x54, 0x06, 0xbf, 0x07, 0x08, 0xd9, 0x66, 0x43, 0xc3,
	0x22, 0x61, 0x1b, 0x7e, 0xe3, 0x9e, 0x3d, 0x38, 0x6e, 0xe0, 0xfc, 0x4b, 0xf0, 0x1d, 0x37, 0x88,
	0x61, 0x02, 0x72, 0x63, 0xfd, 0xb8, 0x0b, 0x9d, 0xf9, 0xed, 0x62, 0x79, 0x37, 0xbe, 0xbe, 0xf5,
	0xd4, 0x93, 0xd2, 0x5e, 0x79, 0xb5, 0x45, 0x58, 0x05, 0x65, 0xec, 0xba, 0xcb, 0x39, 0x99, 0xdd,
	0x4d, 0x5d, 0x8f, 0xa8, 0x02, 0x3e, 0x87, 0x6e, 0x19, 0xa8, 0x27, 0x37, 0xaa, 0x58, 0x32, 0x1f,
	0xa7, 0xbe, 0xbb, 0xf4, 0x67, 0xae, 0xa7, 0x4a, 0xf8, 0x14, 0xa4, 0xf9, 0xd4, 0xbf, 0x52, 0x5b,
	0xc3, 0xcf, 0xd0, 0x3b, 0x2c, 0x52, 0xd2, 0xfe, 0x6c, 0xb1, 0x74, 0x66, 0xbe, 0xef, 0x39, 0x0b,
	0xcf, 0xad, 0xfe, 0xf8, 0xdf, 0x22, 0x7c, 0x06, 0xb2, 0x33, 0xf6, 0xeb, 0x84, 0x2a, 0x60, 0x0c,
	0x3d, 0x67, 0xec, 0x37, 0x28, 0x55, 0x9c, 0x28, 0x8f, 0xfb, 0x01, 0xfa, 0xb9, 0x1f, 0xa0, 0xdf,
	0xfb, 0x01, 0x0a, 0xda, 0xfc, 0xfd, 0xbd, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x1a, 0xa1,
	0xbe, 0xf7, 0x02, 0x00, 0x00,
Jakub Sztandera's avatar
Jakub Sztandera committed
298 299
}

300 301 302
func (m *Message) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
Steven Allen's avatar
Steven Allen committed
303
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
304 305 306 307 308 309 310
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *Message) MarshalTo(dAtA []byte) (int, error) {
Steven Allen's avatar
Steven Allen committed
311 312 313 314 315 316
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
317 318 319
	_ = i
	var l int
	_ = l
Steven Allen's avatar
Steven Allen committed
320 321 322
	if m.XXX_unrecognized != nil {
		i -= len(m.XXX_unrecognized)
		copy(dAtA[i:], m.XXX_unrecognized)
323
	}
Steven Allen's avatar
Steven Allen committed
324 325 326 327
	if m.ClusterLevelRaw != 0 {
		i = encodeVarintDht(dAtA, i, uint64(m.ClusterLevelRaw))
		i--
		dAtA[i] = 0x50
328
	}
Steven Allen's avatar
Steven Allen committed
329 330 331 332 333 334 335 336 337 338 339 340
	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
341 342 343
		}
	}
	if len(m.CloserPeers) > 0 {
Steven Allen's avatar
Steven Allen committed
344 345 346 347 348 349 350 351
		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))
352
			}
Steven Allen's avatar
Steven Allen committed
353 354
			i--
			dAtA[i] = 0x42
355 356
		}
	}
Steven Allen's avatar
Steven Allen committed
357 358 359
	if m.Record != nil {
		{
			size, err := m.Record.MarshalToSizedBuffer(dAtA[:i])
360 361 362
			if err != nil {
				return 0, err
			}
Steven Allen's avatar
Steven Allen committed
363 364
			i -= size
			i = encodeVarintDht(dAtA, i, uint64(size))
365
		}
Steven Allen's avatar
Steven Allen committed
366 367
		i--
		dAtA[i] = 0x1a
368
	}
Steven Allen's avatar
Steven Allen committed
369 370 371 372 373 374
	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
375
	}
Steven Allen's avatar
Steven Allen committed
376 377 378 379
	if m.Type != 0 {
		i = encodeVarintDht(dAtA, i, uint64(m.Type))
		i--
		dAtA[i] = 0x8
380
	}
Steven Allen's avatar
Steven Allen committed
381
	return len(dAtA) - i, nil
382 383 384 385 386
}

func (m *Message_Peer) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
Steven Allen's avatar
Steven Allen committed
387
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
388 389 390 391 392 393 394
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *Message_Peer) MarshalTo(dAtA []byte) (int, error) {
Steven Allen's avatar
Steven Allen committed
395 396 397 398 399 400
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *Message_Peer) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
401 402 403
	_ = i
	var l int
	_ = l
Steven Allen's avatar
Steven Allen committed
404 405 406 407 408 409 410 411
	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
412 413
	}
	if len(m.Addrs) > 0 {
Steven Allen's avatar
Steven Allen committed
414 415 416 417 418
		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--
419 420 421
			dAtA[i] = 0x12
		}
	}
Steven Allen's avatar
Steven Allen committed
422 423 424 425 426 427 428
	{
		size := m.Id.Size()
		i -= size
		if _, err := m.Id.MarshalTo(dAtA[i:]); err != nil {
			return 0, err
		}
		i = encodeVarintDht(dAtA, i, uint64(size))
429
	}
Steven Allen's avatar
Steven Allen committed
430 431
	i--
	dAtA[i] = 0xa
Steven Allen's avatar
Steven Allen committed
432
	return len(dAtA) - i, nil
433 434 435
}

func encodeVarintDht(dAtA []byte, offset int, v uint64) int {
Steven Allen's avatar
Steven Allen committed
436 437
	offset -= sovDht(v)
	base := offset
438 439 440 441 442 443
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
Steven Allen's avatar
Steven Allen committed
444
	return base
445 446
}
func (m *Message) Size() (n int) {
Jakub Sztandera's avatar
Jakub Sztandera committed
447 448 449
	if m == nil {
		return 0
	}
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
	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) {
Jakub Sztandera's avatar
Jakub Sztandera committed
485 486 487
	if m == nil {
		return 0
	}
488 489
	var l int
	_ = l
Steven Allen's avatar
Steven Allen committed
490 491
	l = m.Id.Size()
	n += 1 + l + sovDht(uint64(l))
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
	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) {
Steven Allen's avatar
Steven Allen committed
508
	return (math_bits.Len64(x|1) + 6) / 7
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
}
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++
Jakub Sztandera's avatar
Jakub Sztandera committed
528
			wire |= uint64(b&0x7F) << shift
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
556
				m.Type |= Message_MessageType(b&0x7F) << shift
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574
				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++
Jakub Sztandera's avatar
Jakub Sztandera committed
575
				byteLen |= int(b&0x7F) << shift
576 577 578 579 580 581 582 583
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthDht
			}
			postIndex := iNdEx + byteLen
Jakub Sztandera's avatar
Jakub Sztandera committed
584 585 586
			if postIndex < 0 {
				return ErrInvalidLengthDht
			}
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
609
				msglen |= int(b&0x7F) << shift
610 611 612 613 614 615 616 617
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthDht
			}
			postIndex := iNdEx + msglen
Jakub Sztandera's avatar
Jakub Sztandera committed
618 619 620
			if postIndex < 0 {
				return ErrInvalidLengthDht
			}
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
645
				msglen |= int(b&0x7F) << shift
646 647 648 649 650 651 652 653
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthDht
			}
			postIndex := iNdEx + msglen
Jakub Sztandera's avatar
Jakub Sztandera committed
654 655 656
			if postIndex < 0 {
				return ErrInvalidLengthDht
			}
657 658 659
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
Steven Allen's avatar
Steven Allen committed
660
			m.CloserPeers = append(m.CloserPeers, Message_Peer{})
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
679
				msglen |= int(b&0x7F) << shift
680 681 682 683 684 685 686 687
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthDht
			}
			postIndex := iNdEx + msglen
Jakub Sztandera's avatar
Jakub Sztandera committed
688 689 690
			if postIndex < 0 {
				return ErrInvalidLengthDht
			}
691 692 693
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
Steven Allen's avatar
Steven Allen committed
694
			m.ProviderPeers = append(m.ProviderPeers, Message_Peer{})
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
713
				m.ClusterLevelRaw |= int32(b&0x7F) << shift
714 715 716 717 718 719 720 721 722 723
				if b < 0x80 {
					break
				}
			}
		default:
			iNdEx = preIndex
			skippy, err := skipDht(dAtA[iNdEx:])
			if err != nil {
				return err
			}
Steven Allen's avatar
Steven Allen committed
724
			if (skippy < 0) || (iNdEx+skippy) < 0 {
Jakub Sztandera's avatar
Jakub Sztandera committed
725 726
				return ErrInvalidLengthDht
			}
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
755
			wire |= uint64(b&0x7F) << shift
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
783
				byteLen |= int(b&0x7F) << shift
784 785 786 787 788 789 790 791
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthDht
			}
			postIndex := iNdEx + byteLen
Jakub Sztandera's avatar
Jakub Sztandera committed
792 793 794
			if postIndex < 0 {
				return ErrInvalidLengthDht
			}
795 796 797
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
Steven Allen's avatar
Steven Allen committed
798 799
			if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815
			}
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
816
				byteLen |= int(b&0x7F) << shift
817 818 819 820 821 822 823 824
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthDht
			}
			postIndex := iNdEx + byteLen
Jakub Sztandera's avatar
Jakub Sztandera committed
825 826 827
			if postIndex < 0 {
				return ErrInvalidLengthDht
			}
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847
			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++
Jakub Sztandera's avatar
Jakub Sztandera committed
848
				m.Connection |= Message_ConnectionType(b&0x7F) << shift
849 850 851 852 853 854 855 856 857 858
				if b < 0x80 {
					break
				}
			}
		default:
			iNdEx = preIndex
			skippy, err := skipDht(dAtA[iNdEx:])
			if err != nil {
				return err
			}
Steven Allen's avatar
Steven Allen committed
859
			if (skippy < 0) || (iNdEx+skippy) < 0 {
Jakub Sztandera's avatar
Jakub Sztandera committed
860 861
				return ErrInvalidLengthDht
			}
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877
			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
Steven Allen's avatar
Steven Allen committed
878
	depth := 0
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
	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
			}
Jakub Sztandera's avatar
Jakub Sztandera committed
931
			iNdEx += length
932
		case 3:
Steven Allen's avatar
Steven Allen committed
933
			depth++
934
		case 4:
Steven Allen's avatar
Steven Allen committed
935 936 937 938
			if depth == 0 {
				return 0, ErrUnexpectedEndOfGroupDht
			}
			depth--
939 940 941 942 943
		case 5:
			iNdEx += 4
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
Steven Allen's avatar
Steven Allen committed
944 945 946
		if iNdEx < 0 {
			return 0, ErrInvalidLengthDht
		}
Steven Allen's avatar
Steven Allen committed
947 948 949
		if depth == 0 {
			return iNdEx, nil
		}
950
	}
Steven Allen's avatar
Steven Allen committed
951
	return 0, io.ErrUnexpectedEOF
952 953 954
}

var (
Steven Allen's avatar
Steven Allen committed
955 956 957
	ErrInvalidLengthDht        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDht          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupDht = fmt.Errorf("proto: unexpected end of group")
958
)