@libp2p/daemon-protocol 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -9
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +233 -344
- package/dist/src/index.js.map +1 -1
- package/dist/src/stream-handler.d.ts +2 -2
- package/dist/src/stream-handler.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.proto +40 -7
- package/src/index.ts +240 -340
- package/src/stream-handler.ts +3 -3
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
|
+
/* eslint-disable complexity */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
|
|
3
5
|
import { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime';
|
|
4
6
|
export var Request;
|
|
5
7
|
(function (Request) {
|
|
@@ -37,56 +39,67 @@ export var Request;
|
|
|
37
39
|
let _codec;
|
|
38
40
|
Request.codec = () => {
|
|
39
41
|
if (_codec == null) {
|
|
40
|
-
_codec = message((obj,
|
|
42
|
+
_codec = message((obj, w, opts = {}) => {
|
|
41
43
|
if (opts.lengthDelimited !== false) {
|
|
42
|
-
|
|
44
|
+
w.fork();
|
|
43
45
|
}
|
|
44
46
|
if (obj.type != null) {
|
|
45
|
-
|
|
46
|
-
Request.Type.codec().encode(obj.type,
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
47
|
+
w.uint32(8);
|
|
48
|
+
Request.Type.codec().encode(obj.type, w);
|
|
50
49
|
}
|
|
51
50
|
if (obj.connect != null) {
|
|
52
|
-
|
|
53
|
-
ConnectRequest.codec().encode(obj.connect,
|
|
51
|
+
w.uint32(18);
|
|
52
|
+
ConnectRequest.codec().encode(obj.connect, w, {
|
|
53
|
+
writeDefaults: false
|
|
54
|
+
});
|
|
54
55
|
}
|
|
55
56
|
if (obj.streamOpen != null) {
|
|
56
|
-
|
|
57
|
-
StreamOpenRequest.codec().encode(obj.streamOpen,
|
|
57
|
+
w.uint32(26);
|
|
58
|
+
StreamOpenRequest.codec().encode(obj.streamOpen, w, {
|
|
59
|
+
writeDefaults: false
|
|
60
|
+
});
|
|
58
61
|
}
|
|
59
62
|
if (obj.streamHandler != null) {
|
|
60
|
-
|
|
61
|
-
StreamHandlerRequest.codec().encode(obj.streamHandler,
|
|
63
|
+
w.uint32(34);
|
|
64
|
+
StreamHandlerRequest.codec().encode(obj.streamHandler, w, {
|
|
65
|
+
writeDefaults: false
|
|
66
|
+
});
|
|
62
67
|
}
|
|
63
68
|
if (obj.dht != null) {
|
|
64
|
-
|
|
65
|
-
DHTRequest.codec().encode(obj.dht,
|
|
69
|
+
w.uint32(42);
|
|
70
|
+
DHTRequest.codec().encode(obj.dht, w, {
|
|
71
|
+
writeDefaults: false
|
|
72
|
+
});
|
|
66
73
|
}
|
|
67
74
|
if (obj.connManager != null) {
|
|
68
|
-
|
|
69
|
-
ConnManagerRequest.codec().encode(obj.connManager,
|
|
75
|
+
w.uint32(50);
|
|
76
|
+
ConnManagerRequest.codec().encode(obj.connManager, w, {
|
|
77
|
+
writeDefaults: false
|
|
78
|
+
});
|
|
70
79
|
}
|
|
71
80
|
if (obj.disconnect != null) {
|
|
72
|
-
|
|
73
|
-
DisconnectRequest.codec().encode(obj.disconnect,
|
|
81
|
+
w.uint32(58);
|
|
82
|
+
DisconnectRequest.codec().encode(obj.disconnect, w, {
|
|
83
|
+
writeDefaults: false
|
|
84
|
+
});
|
|
74
85
|
}
|
|
75
86
|
if (obj.pubsub != null) {
|
|
76
|
-
|
|
77
|
-
PSRequest.codec().encode(obj.pubsub,
|
|
87
|
+
w.uint32(66);
|
|
88
|
+
PSRequest.codec().encode(obj.pubsub, w, {
|
|
89
|
+
writeDefaults: false
|
|
90
|
+
});
|
|
78
91
|
}
|
|
79
92
|
if (obj.peerStore != null) {
|
|
80
|
-
|
|
81
|
-
PeerstoreRequest.codec().encode(obj.peerStore,
|
|
93
|
+
w.uint32(74);
|
|
94
|
+
PeerstoreRequest.codec().encode(obj.peerStore, w, {
|
|
95
|
+
writeDefaults: false
|
|
96
|
+
});
|
|
82
97
|
}
|
|
83
98
|
if (opts.lengthDelimited !== false) {
|
|
84
|
-
|
|
99
|
+
w.ldelim();
|
|
85
100
|
}
|
|
86
101
|
}, (reader, length) => {
|
|
87
|
-
const obj = {
|
|
88
|
-
type: Type.IDENTIFY
|
|
89
|
-
};
|
|
102
|
+
const obj = {};
|
|
90
103
|
const end = length == null ? reader.len : reader.pos + length;
|
|
91
104
|
while (reader.pos < end) {
|
|
92
105
|
const tag = reader.uint32();
|
|
@@ -123,9 +136,6 @@ export var Request;
|
|
|
123
136
|
break;
|
|
124
137
|
}
|
|
125
138
|
}
|
|
126
|
-
if (obj.type == null) {
|
|
127
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
128
|
-
}
|
|
129
139
|
return obj;
|
|
130
140
|
});
|
|
131
141
|
}
|
|
@@ -158,56 +168,63 @@ export var Response;
|
|
|
158
168
|
let _codec;
|
|
159
169
|
Response.codec = () => {
|
|
160
170
|
if (_codec == null) {
|
|
161
|
-
_codec = message((obj,
|
|
171
|
+
_codec = message((obj, w, opts = {}) => {
|
|
162
172
|
if (opts.lengthDelimited !== false) {
|
|
163
|
-
|
|
173
|
+
w.fork();
|
|
164
174
|
}
|
|
165
175
|
if (obj.type != null) {
|
|
166
|
-
|
|
167
|
-
Response.Type.codec().encode(obj.type,
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
176
|
+
w.uint32(8);
|
|
177
|
+
Response.Type.codec().encode(obj.type, w);
|
|
171
178
|
}
|
|
172
179
|
if (obj.error != null) {
|
|
173
|
-
|
|
174
|
-
ErrorResponse.codec().encode(obj.error,
|
|
180
|
+
w.uint32(18);
|
|
181
|
+
ErrorResponse.codec().encode(obj.error, w, {
|
|
182
|
+
writeDefaults: false
|
|
183
|
+
});
|
|
175
184
|
}
|
|
176
185
|
if (obj.streamInfo != null) {
|
|
177
|
-
|
|
178
|
-
StreamInfo.codec().encode(obj.streamInfo,
|
|
186
|
+
w.uint32(26);
|
|
187
|
+
StreamInfo.codec().encode(obj.streamInfo, w, {
|
|
188
|
+
writeDefaults: false
|
|
189
|
+
});
|
|
179
190
|
}
|
|
180
191
|
if (obj.identify != null) {
|
|
181
|
-
|
|
182
|
-
IdentifyResponse.codec().encode(obj.identify,
|
|
192
|
+
w.uint32(34);
|
|
193
|
+
IdentifyResponse.codec().encode(obj.identify, w, {
|
|
194
|
+
writeDefaults: false
|
|
195
|
+
});
|
|
183
196
|
}
|
|
184
197
|
if (obj.dht != null) {
|
|
185
|
-
|
|
186
|
-
DHTResponse.codec().encode(obj.dht,
|
|
198
|
+
w.uint32(42);
|
|
199
|
+
DHTResponse.codec().encode(obj.dht, w, {
|
|
200
|
+
writeDefaults: false
|
|
201
|
+
});
|
|
187
202
|
}
|
|
188
203
|
if (obj.peers != null) {
|
|
189
204
|
for (const value of obj.peers) {
|
|
190
|
-
|
|
191
|
-
PeerInfo.codec().encode(value,
|
|
205
|
+
w.uint32(50);
|
|
206
|
+
PeerInfo.codec().encode(value, w, {
|
|
207
|
+
writeDefaults: true
|
|
208
|
+
});
|
|
192
209
|
}
|
|
193
210
|
}
|
|
194
|
-
else {
|
|
195
|
-
throw new Error('Protocol error: required field "peers" was not found in object');
|
|
196
|
-
}
|
|
197
211
|
if (obj.pubsub != null) {
|
|
198
|
-
|
|
199
|
-
PSResponse.codec().encode(obj.pubsub,
|
|
212
|
+
w.uint32(58);
|
|
213
|
+
PSResponse.codec().encode(obj.pubsub, w, {
|
|
214
|
+
writeDefaults: false
|
|
215
|
+
});
|
|
200
216
|
}
|
|
201
217
|
if (obj.peerStore != null) {
|
|
202
|
-
|
|
203
|
-
PeerstoreResponse.codec().encode(obj.peerStore,
|
|
218
|
+
w.uint32(66);
|
|
219
|
+
PeerstoreResponse.codec().encode(obj.peerStore, w, {
|
|
220
|
+
writeDefaults: false
|
|
221
|
+
});
|
|
204
222
|
}
|
|
205
223
|
if (opts.lengthDelimited !== false) {
|
|
206
|
-
|
|
224
|
+
w.ldelim();
|
|
207
225
|
}
|
|
208
226
|
}, (reader, length) => {
|
|
209
227
|
const obj = {
|
|
210
|
-
type: Type.OK,
|
|
211
228
|
peers: []
|
|
212
229
|
};
|
|
213
230
|
const end = length == null ? reader.len : reader.pos + length;
|
|
@@ -243,9 +260,6 @@ export var Response;
|
|
|
243
260
|
break;
|
|
244
261
|
}
|
|
245
262
|
}
|
|
246
|
-
if (obj.type == null) {
|
|
247
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
248
|
-
}
|
|
249
263
|
return obj;
|
|
250
264
|
});
|
|
251
265
|
}
|
|
@@ -263,28 +277,22 @@ export var IdentifyResponse;
|
|
|
263
277
|
let _codec;
|
|
264
278
|
IdentifyResponse.codec = () => {
|
|
265
279
|
if (_codec == null) {
|
|
266
|
-
_codec = message((obj,
|
|
280
|
+
_codec = message((obj, w, opts = {}) => {
|
|
267
281
|
if (opts.lengthDelimited !== false) {
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
if (obj.id != null) {
|
|
271
|
-
writer.uint32(10);
|
|
272
|
-
writer.bytes(obj.id);
|
|
282
|
+
w.fork();
|
|
273
283
|
}
|
|
274
|
-
|
|
275
|
-
|
|
284
|
+
if (opts.writeDefaults === true || (obj.id != null && obj.id.byteLength > 0)) {
|
|
285
|
+
w.uint32(10);
|
|
286
|
+
w.bytes(obj.id);
|
|
276
287
|
}
|
|
277
288
|
if (obj.addrs != null) {
|
|
278
289
|
for (const value of obj.addrs) {
|
|
279
|
-
|
|
280
|
-
|
|
290
|
+
w.uint32(18);
|
|
291
|
+
w.bytes(value);
|
|
281
292
|
}
|
|
282
293
|
}
|
|
283
|
-
else {
|
|
284
|
-
throw new Error('Protocol error: required field "addrs" was not found in object');
|
|
285
|
-
}
|
|
286
294
|
if (opts.lengthDelimited !== false) {
|
|
287
|
-
|
|
295
|
+
w.ldelim();
|
|
288
296
|
}
|
|
289
297
|
}, (reader, length) => {
|
|
290
298
|
const obj = {
|
|
@@ -306,9 +314,6 @@ export var IdentifyResponse;
|
|
|
306
314
|
break;
|
|
307
315
|
}
|
|
308
316
|
}
|
|
309
|
-
if (obj.id == null) {
|
|
310
|
-
throw new Error('Protocol error: value for required field "id" was not found in protobuf');
|
|
311
|
-
}
|
|
312
317
|
return obj;
|
|
313
318
|
});
|
|
314
319
|
}
|
|
@@ -326,32 +331,26 @@ export var ConnectRequest;
|
|
|
326
331
|
let _codec;
|
|
327
332
|
ConnectRequest.codec = () => {
|
|
328
333
|
if (_codec == null) {
|
|
329
|
-
_codec = message((obj,
|
|
334
|
+
_codec = message((obj, w, opts = {}) => {
|
|
330
335
|
if (opts.lengthDelimited !== false) {
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
if (obj.peer != null) {
|
|
334
|
-
writer.uint32(10);
|
|
335
|
-
writer.bytes(obj.peer);
|
|
336
|
+
w.fork();
|
|
336
337
|
}
|
|
337
|
-
|
|
338
|
-
|
|
338
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
339
|
+
w.uint32(10);
|
|
340
|
+
w.bytes(obj.peer);
|
|
339
341
|
}
|
|
340
342
|
if (obj.addrs != null) {
|
|
341
343
|
for (const value of obj.addrs) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
w.uint32(18);
|
|
345
|
+
w.bytes(value);
|
|
344
346
|
}
|
|
345
347
|
}
|
|
346
|
-
else {
|
|
347
|
-
throw new Error('Protocol error: required field "addrs" was not found in object');
|
|
348
|
-
}
|
|
349
348
|
if (obj.timeout != null) {
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
w.uint32(24);
|
|
350
|
+
w.int64(obj.timeout);
|
|
352
351
|
}
|
|
353
352
|
if (opts.lengthDelimited !== false) {
|
|
354
|
-
|
|
353
|
+
w.ldelim();
|
|
355
354
|
}
|
|
356
355
|
}, (reader, length) => {
|
|
357
356
|
const obj = {
|
|
@@ -376,9 +375,6 @@ export var ConnectRequest;
|
|
|
376
375
|
break;
|
|
377
376
|
}
|
|
378
377
|
}
|
|
379
|
-
if (obj.peer == null) {
|
|
380
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf');
|
|
381
|
-
}
|
|
382
378
|
return obj;
|
|
383
379
|
});
|
|
384
380
|
}
|
|
@@ -396,32 +392,26 @@ export var StreamOpenRequest;
|
|
|
396
392
|
let _codec;
|
|
397
393
|
StreamOpenRequest.codec = () => {
|
|
398
394
|
if (_codec == null) {
|
|
399
|
-
_codec = message((obj,
|
|
395
|
+
_codec = message((obj, w, opts = {}) => {
|
|
400
396
|
if (opts.lengthDelimited !== false) {
|
|
401
|
-
|
|
397
|
+
w.fork();
|
|
402
398
|
}
|
|
403
|
-
if (obj.peer != null) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
throw new Error('Protocol error: required field "peer" was not found in object');
|
|
399
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
400
|
+
w.uint32(10);
|
|
401
|
+
w.bytes(obj.peer);
|
|
409
402
|
}
|
|
410
403
|
if (obj.proto != null) {
|
|
411
404
|
for (const value of obj.proto) {
|
|
412
|
-
|
|
413
|
-
|
|
405
|
+
w.uint32(18);
|
|
406
|
+
w.string(value);
|
|
414
407
|
}
|
|
415
408
|
}
|
|
416
|
-
else {
|
|
417
|
-
throw new Error('Protocol error: required field "proto" was not found in object');
|
|
418
|
-
}
|
|
419
409
|
if (obj.timeout != null) {
|
|
420
|
-
|
|
421
|
-
|
|
410
|
+
w.uint32(24);
|
|
411
|
+
w.int64(obj.timeout);
|
|
422
412
|
}
|
|
423
413
|
if (opts.lengthDelimited !== false) {
|
|
424
|
-
|
|
414
|
+
w.ldelim();
|
|
425
415
|
}
|
|
426
416
|
}, (reader, length) => {
|
|
427
417
|
const obj = {
|
|
@@ -446,9 +436,6 @@ export var StreamOpenRequest;
|
|
|
446
436
|
break;
|
|
447
437
|
}
|
|
448
438
|
}
|
|
449
|
-
if (obj.peer == null) {
|
|
450
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf');
|
|
451
|
-
}
|
|
452
439
|
return obj;
|
|
453
440
|
});
|
|
454
441
|
}
|
|
@@ -466,28 +453,22 @@ export var StreamHandlerRequest;
|
|
|
466
453
|
let _codec;
|
|
467
454
|
StreamHandlerRequest.codec = () => {
|
|
468
455
|
if (_codec == null) {
|
|
469
|
-
_codec = message((obj,
|
|
456
|
+
_codec = message((obj, w, opts = {}) => {
|
|
470
457
|
if (opts.lengthDelimited !== false) {
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
if (obj.addr != null) {
|
|
474
|
-
writer.uint32(10);
|
|
475
|
-
writer.bytes(obj.addr);
|
|
458
|
+
w.fork();
|
|
476
459
|
}
|
|
477
|
-
|
|
478
|
-
|
|
460
|
+
if (opts.writeDefaults === true || (obj.addr != null && obj.addr.byteLength > 0)) {
|
|
461
|
+
w.uint32(10);
|
|
462
|
+
w.bytes(obj.addr);
|
|
479
463
|
}
|
|
480
464
|
if (obj.proto != null) {
|
|
481
465
|
for (const value of obj.proto) {
|
|
482
|
-
|
|
483
|
-
|
|
466
|
+
w.uint32(18);
|
|
467
|
+
w.string(value);
|
|
484
468
|
}
|
|
485
469
|
}
|
|
486
|
-
else {
|
|
487
|
-
throw new Error('Protocol error: required field "proto" was not found in object');
|
|
488
|
-
}
|
|
489
470
|
if (opts.lengthDelimited !== false) {
|
|
490
|
-
|
|
471
|
+
w.ldelim();
|
|
491
472
|
}
|
|
492
473
|
}, (reader, length) => {
|
|
493
474
|
const obj = {
|
|
@@ -509,9 +490,6 @@ export var StreamHandlerRequest;
|
|
|
509
490
|
break;
|
|
510
491
|
}
|
|
511
492
|
}
|
|
512
|
-
if (obj.addr == null) {
|
|
513
|
-
throw new Error('Protocol error: value for required field "addr" was not found in protobuf');
|
|
514
|
-
}
|
|
515
493
|
return obj;
|
|
516
494
|
});
|
|
517
495
|
}
|
|
@@ -529,19 +507,16 @@ export var ErrorResponse;
|
|
|
529
507
|
let _codec;
|
|
530
508
|
ErrorResponse.codec = () => {
|
|
531
509
|
if (_codec == null) {
|
|
532
|
-
_codec = message((obj,
|
|
510
|
+
_codec = message((obj, w, opts = {}) => {
|
|
533
511
|
if (opts.lengthDelimited !== false) {
|
|
534
|
-
|
|
512
|
+
w.fork();
|
|
535
513
|
}
|
|
536
|
-
if (obj.msg
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
throw new Error('Protocol error: required field "msg" was not found in object');
|
|
514
|
+
if (opts.writeDefaults === true || obj.msg !== '') {
|
|
515
|
+
w.uint32(10);
|
|
516
|
+
w.string(obj.msg);
|
|
542
517
|
}
|
|
543
518
|
if (opts.lengthDelimited !== false) {
|
|
544
|
-
|
|
519
|
+
w.ldelim();
|
|
545
520
|
}
|
|
546
521
|
}, (reader, length) => {
|
|
547
522
|
const obj = {
|
|
@@ -559,9 +534,6 @@ export var ErrorResponse;
|
|
|
559
534
|
break;
|
|
560
535
|
}
|
|
561
536
|
}
|
|
562
|
-
if (obj.msg == null) {
|
|
563
|
-
throw new Error('Protocol error: value for required field "msg" was not found in protobuf');
|
|
564
|
-
}
|
|
565
537
|
return obj;
|
|
566
538
|
});
|
|
567
539
|
}
|
|
@@ -579,33 +551,24 @@ export var StreamInfo;
|
|
|
579
551
|
let _codec;
|
|
580
552
|
StreamInfo.codec = () => {
|
|
581
553
|
if (_codec == null) {
|
|
582
|
-
_codec = message((obj,
|
|
554
|
+
_codec = message((obj, w, opts = {}) => {
|
|
583
555
|
if (opts.lengthDelimited !== false) {
|
|
584
|
-
|
|
556
|
+
w.fork();
|
|
585
557
|
}
|
|
586
|
-
if (obj.peer != null) {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
throw new Error('Protocol error: required field "peer" was not found in object');
|
|
558
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
559
|
+
w.uint32(10);
|
|
560
|
+
w.bytes(obj.peer);
|
|
592
561
|
}
|
|
593
|
-
if (obj.addr != null) {
|
|
594
|
-
|
|
595
|
-
|
|
562
|
+
if (opts.writeDefaults === true || (obj.addr != null && obj.addr.byteLength > 0)) {
|
|
563
|
+
w.uint32(18);
|
|
564
|
+
w.bytes(obj.addr);
|
|
596
565
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (obj.proto != null) {
|
|
601
|
-
writer.uint32(26);
|
|
602
|
-
writer.string(obj.proto);
|
|
603
|
-
}
|
|
604
|
-
else {
|
|
605
|
-
throw new Error('Protocol error: required field "proto" was not found in object');
|
|
566
|
+
if (opts.writeDefaults === true || obj.proto !== '') {
|
|
567
|
+
w.uint32(26);
|
|
568
|
+
w.string(obj.proto);
|
|
606
569
|
}
|
|
607
570
|
if (opts.lengthDelimited !== false) {
|
|
608
|
-
|
|
571
|
+
w.ldelim();
|
|
609
572
|
}
|
|
610
573
|
}, (reader, length) => {
|
|
611
574
|
const obj = {
|
|
@@ -631,15 +594,6 @@ export var StreamInfo;
|
|
|
631
594
|
break;
|
|
632
595
|
}
|
|
633
596
|
}
|
|
634
|
-
if (obj.peer == null) {
|
|
635
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf');
|
|
636
|
-
}
|
|
637
|
-
if (obj.addr == null) {
|
|
638
|
-
throw new Error('Protocol error: value for required field "addr" was not found in protobuf');
|
|
639
|
-
}
|
|
640
|
-
if (obj.proto == null) {
|
|
641
|
-
throw new Error('Protocol error: value for required field "proto" was not found in protobuf');
|
|
642
|
-
}
|
|
643
597
|
return obj;
|
|
644
598
|
});
|
|
645
599
|
}
|
|
@@ -686,48 +640,43 @@ export var DHTRequest;
|
|
|
686
640
|
let _codec;
|
|
687
641
|
DHTRequest.codec = () => {
|
|
688
642
|
if (_codec == null) {
|
|
689
|
-
_codec = message((obj,
|
|
643
|
+
_codec = message((obj, w, opts = {}) => {
|
|
690
644
|
if (opts.lengthDelimited !== false) {
|
|
691
|
-
|
|
645
|
+
w.fork();
|
|
692
646
|
}
|
|
693
647
|
if (obj.type != null) {
|
|
694
|
-
|
|
695
|
-
DHTRequest.Type.codec().encode(obj.type,
|
|
696
|
-
}
|
|
697
|
-
else {
|
|
698
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
648
|
+
w.uint32(8);
|
|
649
|
+
DHTRequest.Type.codec().encode(obj.type, w);
|
|
699
650
|
}
|
|
700
651
|
if (obj.peer != null) {
|
|
701
|
-
|
|
702
|
-
|
|
652
|
+
w.uint32(18);
|
|
653
|
+
w.bytes(obj.peer);
|
|
703
654
|
}
|
|
704
655
|
if (obj.cid != null) {
|
|
705
|
-
|
|
706
|
-
|
|
656
|
+
w.uint32(26);
|
|
657
|
+
w.bytes(obj.cid);
|
|
707
658
|
}
|
|
708
659
|
if (obj.key != null) {
|
|
709
|
-
|
|
710
|
-
|
|
660
|
+
w.uint32(34);
|
|
661
|
+
w.bytes(obj.key);
|
|
711
662
|
}
|
|
712
663
|
if (obj.value != null) {
|
|
713
|
-
|
|
714
|
-
|
|
664
|
+
w.uint32(42);
|
|
665
|
+
w.bytes(obj.value);
|
|
715
666
|
}
|
|
716
667
|
if (obj.count != null) {
|
|
717
|
-
|
|
718
|
-
|
|
668
|
+
w.uint32(48);
|
|
669
|
+
w.int32(obj.count);
|
|
719
670
|
}
|
|
720
671
|
if (obj.timeout != null) {
|
|
721
|
-
|
|
722
|
-
|
|
672
|
+
w.uint32(56);
|
|
673
|
+
w.int64(obj.timeout);
|
|
723
674
|
}
|
|
724
675
|
if (opts.lengthDelimited !== false) {
|
|
725
|
-
|
|
676
|
+
w.ldelim();
|
|
726
677
|
}
|
|
727
678
|
}, (reader, length) => {
|
|
728
|
-
const obj = {
|
|
729
|
-
type: Type.FIND_PEER
|
|
730
|
-
};
|
|
679
|
+
const obj = {};
|
|
731
680
|
const end = length == null ? reader.len : reader.pos + length;
|
|
732
681
|
while (reader.pos < end) {
|
|
733
682
|
const tag = reader.uint32();
|
|
@@ -758,9 +707,6 @@ export var DHTRequest;
|
|
|
758
707
|
break;
|
|
759
708
|
}
|
|
760
709
|
}
|
|
761
|
-
if (obj.type == null) {
|
|
762
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
763
|
-
}
|
|
764
710
|
return obj;
|
|
765
711
|
});
|
|
766
712
|
}
|
|
@@ -795,32 +741,29 @@ export var DHTResponse;
|
|
|
795
741
|
let _codec;
|
|
796
742
|
DHTResponse.codec = () => {
|
|
797
743
|
if (_codec == null) {
|
|
798
|
-
_codec = message((obj,
|
|
744
|
+
_codec = message((obj, w, opts = {}) => {
|
|
799
745
|
if (opts.lengthDelimited !== false) {
|
|
800
|
-
|
|
746
|
+
w.fork();
|
|
801
747
|
}
|
|
802
748
|
if (obj.type != null) {
|
|
803
|
-
|
|
804
|
-
DHTResponse.Type.codec().encode(obj.type,
|
|
805
|
-
}
|
|
806
|
-
else {
|
|
807
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
749
|
+
w.uint32(8);
|
|
750
|
+
DHTResponse.Type.codec().encode(obj.type, w);
|
|
808
751
|
}
|
|
809
752
|
if (obj.peer != null) {
|
|
810
|
-
|
|
811
|
-
PeerInfo.codec().encode(obj.peer,
|
|
753
|
+
w.uint32(18);
|
|
754
|
+
PeerInfo.codec().encode(obj.peer, w, {
|
|
755
|
+
writeDefaults: false
|
|
756
|
+
});
|
|
812
757
|
}
|
|
813
758
|
if (obj.value != null) {
|
|
814
|
-
|
|
815
|
-
|
|
759
|
+
w.uint32(26);
|
|
760
|
+
w.bytes(obj.value);
|
|
816
761
|
}
|
|
817
762
|
if (opts.lengthDelimited !== false) {
|
|
818
|
-
|
|
763
|
+
w.ldelim();
|
|
819
764
|
}
|
|
820
765
|
}, (reader, length) => {
|
|
821
|
-
const obj = {
|
|
822
|
-
type: Type.BEGIN
|
|
823
|
-
};
|
|
766
|
+
const obj = {};
|
|
824
767
|
const end = length == null ? reader.len : reader.pos + length;
|
|
825
768
|
while (reader.pos < end) {
|
|
826
769
|
const tag = reader.uint32();
|
|
@@ -839,9 +782,6 @@ export var DHTResponse;
|
|
|
839
782
|
break;
|
|
840
783
|
}
|
|
841
784
|
}
|
|
842
|
-
if (obj.type == null) {
|
|
843
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
844
|
-
}
|
|
845
785
|
return obj;
|
|
846
786
|
});
|
|
847
787
|
}
|
|
@@ -859,28 +799,22 @@ export var PeerInfo;
|
|
|
859
799
|
let _codec;
|
|
860
800
|
PeerInfo.codec = () => {
|
|
861
801
|
if (_codec == null) {
|
|
862
|
-
_codec = message((obj,
|
|
802
|
+
_codec = message((obj, w, opts = {}) => {
|
|
863
803
|
if (opts.lengthDelimited !== false) {
|
|
864
|
-
|
|
865
|
-
}
|
|
866
|
-
if (obj.id != null) {
|
|
867
|
-
writer.uint32(10);
|
|
868
|
-
writer.bytes(obj.id);
|
|
804
|
+
w.fork();
|
|
869
805
|
}
|
|
870
|
-
|
|
871
|
-
|
|
806
|
+
if (opts.writeDefaults === true || (obj.id != null && obj.id.byteLength > 0)) {
|
|
807
|
+
w.uint32(10);
|
|
808
|
+
w.bytes(obj.id);
|
|
872
809
|
}
|
|
873
810
|
if (obj.addrs != null) {
|
|
874
811
|
for (const value of obj.addrs) {
|
|
875
|
-
|
|
876
|
-
|
|
812
|
+
w.uint32(18);
|
|
813
|
+
w.bytes(value);
|
|
877
814
|
}
|
|
878
815
|
}
|
|
879
|
-
else {
|
|
880
|
-
throw new Error('Protocol error: required field "addrs" was not found in object');
|
|
881
|
-
}
|
|
882
816
|
if (opts.lengthDelimited !== false) {
|
|
883
|
-
|
|
817
|
+
w.ldelim();
|
|
884
818
|
}
|
|
885
819
|
}, (reader, length) => {
|
|
886
820
|
const obj = {
|
|
@@ -902,9 +836,6 @@ export var PeerInfo;
|
|
|
902
836
|
break;
|
|
903
837
|
}
|
|
904
838
|
}
|
|
905
|
-
if (obj.id == null) {
|
|
906
|
-
throw new Error('Protocol error: value for required field "id" was not found in protobuf');
|
|
907
|
-
}
|
|
908
839
|
return obj;
|
|
909
840
|
});
|
|
910
841
|
}
|
|
@@ -939,36 +870,31 @@ export var ConnManagerRequest;
|
|
|
939
870
|
let _codec;
|
|
940
871
|
ConnManagerRequest.codec = () => {
|
|
941
872
|
if (_codec == null) {
|
|
942
|
-
_codec = message((obj,
|
|
873
|
+
_codec = message((obj, w, opts = {}) => {
|
|
943
874
|
if (opts.lengthDelimited !== false) {
|
|
944
|
-
|
|
875
|
+
w.fork();
|
|
945
876
|
}
|
|
946
877
|
if (obj.type != null) {
|
|
947
|
-
|
|
948
|
-
ConnManagerRequest.Type.codec().encode(obj.type,
|
|
949
|
-
}
|
|
950
|
-
else {
|
|
951
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
878
|
+
w.uint32(8);
|
|
879
|
+
ConnManagerRequest.Type.codec().encode(obj.type, w);
|
|
952
880
|
}
|
|
953
881
|
if (obj.peer != null) {
|
|
954
|
-
|
|
955
|
-
|
|
882
|
+
w.uint32(18);
|
|
883
|
+
w.bytes(obj.peer);
|
|
956
884
|
}
|
|
957
885
|
if (obj.tag != null) {
|
|
958
|
-
|
|
959
|
-
|
|
886
|
+
w.uint32(26);
|
|
887
|
+
w.string(obj.tag);
|
|
960
888
|
}
|
|
961
889
|
if (obj.weight != null) {
|
|
962
|
-
|
|
963
|
-
|
|
890
|
+
w.uint32(32);
|
|
891
|
+
w.int64(obj.weight);
|
|
964
892
|
}
|
|
965
893
|
if (opts.lengthDelimited !== false) {
|
|
966
|
-
|
|
894
|
+
w.ldelim();
|
|
967
895
|
}
|
|
968
896
|
}, (reader, length) => {
|
|
969
|
-
const obj = {
|
|
970
|
-
type: Type.TAG_PEER
|
|
971
|
-
};
|
|
897
|
+
const obj = {};
|
|
972
898
|
const end = length == null ? reader.len : reader.pos + length;
|
|
973
899
|
while (reader.pos < end) {
|
|
974
900
|
const tag = reader.uint32();
|
|
@@ -990,9 +916,6 @@ export var ConnManagerRequest;
|
|
|
990
916
|
break;
|
|
991
917
|
}
|
|
992
918
|
}
|
|
993
|
-
if (obj.type == null) {
|
|
994
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
995
|
-
}
|
|
996
919
|
return obj;
|
|
997
920
|
});
|
|
998
921
|
}
|
|
@@ -1010,19 +933,16 @@ export var DisconnectRequest;
|
|
|
1010
933
|
let _codec;
|
|
1011
934
|
DisconnectRequest.codec = () => {
|
|
1012
935
|
if (_codec == null) {
|
|
1013
|
-
_codec = message((obj,
|
|
936
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1014
937
|
if (opts.lengthDelimited !== false) {
|
|
1015
|
-
|
|
1016
|
-
}
|
|
1017
|
-
if (obj.peer != null) {
|
|
1018
|
-
writer.uint32(10);
|
|
1019
|
-
writer.bytes(obj.peer);
|
|
938
|
+
w.fork();
|
|
1020
939
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
940
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
941
|
+
w.uint32(10);
|
|
942
|
+
w.bytes(obj.peer);
|
|
1023
943
|
}
|
|
1024
944
|
if (opts.lengthDelimited !== false) {
|
|
1025
|
-
|
|
945
|
+
w.ldelim();
|
|
1026
946
|
}
|
|
1027
947
|
}, (reader, length) => {
|
|
1028
948
|
const obj = {
|
|
@@ -1040,9 +960,6 @@ export var DisconnectRequest;
|
|
|
1040
960
|
break;
|
|
1041
961
|
}
|
|
1042
962
|
}
|
|
1043
|
-
if (obj.peer == null) {
|
|
1044
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf');
|
|
1045
|
-
}
|
|
1046
963
|
return obj;
|
|
1047
964
|
});
|
|
1048
965
|
}
|
|
@@ -1079,32 +996,27 @@ export var PSRequest;
|
|
|
1079
996
|
let _codec;
|
|
1080
997
|
PSRequest.codec = () => {
|
|
1081
998
|
if (_codec == null) {
|
|
1082
|
-
_codec = message((obj,
|
|
999
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1083
1000
|
if (opts.lengthDelimited !== false) {
|
|
1084
|
-
|
|
1001
|
+
w.fork();
|
|
1085
1002
|
}
|
|
1086
1003
|
if (obj.type != null) {
|
|
1087
|
-
|
|
1088
|
-
PSRequest.Type.codec().encode(obj.type,
|
|
1089
|
-
}
|
|
1090
|
-
else {
|
|
1091
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
1004
|
+
w.uint32(8);
|
|
1005
|
+
PSRequest.Type.codec().encode(obj.type, w);
|
|
1092
1006
|
}
|
|
1093
1007
|
if (obj.topic != null) {
|
|
1094
|
-
|
|
1095
|
-
|
|
1008
|
+
w.uint32(18);
|
|
1009
|
+
w.string(obj.topic);
|
|
1096
1010
|
}
|
|
1097
1011
|
if (obj.data != null) {
|
|
1098
|
-
|
|
1099
|
-
|
|
1012
|
+
w.uint32(26);
|
|
1013
|
+
w.bytes(obj.data);
|
|
1100
1014
|
}
|
|
1101
1015
|
if (opts.lengthDelimited !== false) {
|
|
1102
|
-
|
|
1016
|
+
w.ldelim();
|
|
1103
1017
|
}
|
|
1104
1018
|
}, (reader, length) => {
|
|
1105
|
-
const obj = {
|
|
1106
|
-
type: Type.GET_TOPICS
|
|
1107
|
-
};
|
|
1019
|
+
const obj = {};
|
|
1108
1020
|
const end = length == null ? reader.len : reader.pos + length;
|
|
1109
1021
|
while (reader.pos < end) {
|
|
1110
1022
|
const tag = reader.uint32();
|
|
@@ -1123,9 +1035,6 @@ export var PSRequest;
|
|
|
1123
1035
|
break;
|
|
1124
1036
|
}
|
|
1125
1037
|
}
|
|
1126
|
-
if (obj.type == null) {
|
|
1127
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
1128
|
-
}
|
|
1129
1038
|
return obj;
|
|
1130
1039
|
});
|
|
1131
1040
|
}
|
|
@@ -1143,41 +1052,38 @@ export var PSMessage;
|
|
|
1143
1052
|
let _codec;
|
|
1144
1053
|
PSMessage.codec = () => {
|
|
1145
1054
|
if (_codec == null) {
|
|
1146
|
-
_codec = message((obj,
|
|
1055
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1147
1056
|
if (opts.lengthDelimited !== false) {
|
|
1148
|
-
|
|
1057
|
+
w.fork();
|
|
1149
1058
|
}
|
|
1150
1059
|
if (obj.from != null) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1060
|
+
w.uint32(10);
|
|
1061
|
+
w.bytes(obj.from);
|
|
1153
1062
|
}
|
|
1154
1063
|
if (obj.data != null) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1064
|
+
w.uint32(18);
|
|
1065
|
+
w.bytes(obj.data);
|
|
1157
1066
|
}
|
|
1158
1067
|
if (obj.seqno != null) {
|
|
1159
|
-
|
|
1160
|
-
|
|
1068
|
+
w.uint32(26);
|
|
1069
|
+
w.bytes(obj.seqno);
|
|
1161
1070
|
}
|
|
1162
1071
|
if (obj.topicIDs != null) {
|
|
1163
1072
|
for (const value of obj.topicIDs) {
|
|
1164
|
-
|
|
1165
|
-
|
|
1073
|
+
w.uint32(34);
|
|
1074
|
+
w.string(value);
|
|
1166
1075
|
}
|
|
1167
1076
|
}
|
|
1168
|
-
else {
|
|
1169
|
-
throw new Error('Protocol error: required field "topicIDs" was not found in object');
|
|
1170
|
-
}
|
|
1171
1077
|
if (obj.signature != null) {
|
|
1172
|
-
|
|
1173
|
-
|
|
1078
|
+
w.uint32(42);
|
|
1079
|
+
w.bytes(obj.signature);
|
|
1174
1080
|
}
|
|
1175
1081
|
if (obj.key != null) {
|
|
1176
|
-
|
|
1177
|
-
|
|
1082
|
+
w.uint32(50);
|
|
1083
|
+
w.bytes(obj.key);
|
|
1178
1084
|
}
|
|
1179
1085
|
if (opts.lengthDelimited !== false) {
|
|
1180
|
-
|
|
1086
|
+
w.ldelim();
|
|
1181
1087
|
}
|
|
1182
1088
|
}, (reader, length) => {
|
|
1183
1089
|
const obj = {
|
|
@@ -1227,30 +1133,24 @@ export var PSResponse;
|
|
|
1227
1133
|
let _codec;
|
|
1228
1134
|
PSResponse.codec = () => {
|
|
1229
1135
|
if (_codec == null) {
|
|
1230
|
-
_codec = message((obj,
|
|
1136
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1231
1137
|
if (opts.lengthDelimited !== false) {
|
|
1232
|
-
|
|
1138
|
+
w.fork();
|
|
1233
1139
|
}
|
|
1234
1140
|
if (obj.topics != null) {
|
|
1235
1141
|
for (const value of obj.topics) {
|
|
1236
|
-
|
|
1237
|
-
|
|
1142
|
+
w.uint32(10);
|
|
1143
|
+
w.string(value);
|
|
1238
1144
|
}
|
|
1239
1145
|
}
|
|
1240
|
-
else {
|
|
1241
|
-
throw new Error('Protocol error: required field "topics" was not found in object');
|
|
1242
|
-
}
|
|
1243
1146
|
if (obj.peerIDs != null) {
|
|
1244
1147
|
for (const value of obj.peerIDs) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1148
|
+
w.uint32(18);
|
|
1149
|
+
w.bytes(value);
|
|
1247
1150
|
}
|
|
1248
1151
|
}
|
|
1249
|
-
else {
|
|
1250
|
-
throw new Error('Protocol error: required field "peerIDs" was not found in object');
|
|
1251
|
-
}
|
|
1252
1152
|
if (opts.lengthDelimited !== false) {
|
|
1253
|
-
|
|
1153
|
+
w.ldelim();
|
|
1254
1154
|
}
|
|
1255
1155
|
}, (reader, length) => {
|
|
1256
1156
|
const obj = {
|
|
@@ -1306,36 +1206,29 @@ export var PeerstoreRequest;
|
|
|
1306
1206
|
let _codec;
|
|
1307
1207
|
PeerstoreRequest.codec = () => {
|
|
1308
1208
|
if (_codec == null) {
|
|
1309
|
-
_codec = message((obj,
|
|
1209
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1310
1210
|
if (opts.lengthDelimited !== false) {
|
|
1311
|
-
|
|
1211
|
+
w.fork();
|
|
1312
1212
|
}
|
|
1313
1213
|
if (obj.type != null) {
|
|
1314
|
-
|
|
1315
|
-
PeerstoreRequest.Type.codec().encode(obj.type,
|
|
1316
|
-
}
|
|
1317
|
-
else {
|
|
1318
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
1214
|
+
w.uint32(8);
|
|
1215
|
+
PeerstoreRequest.Type.codec().encode(obj.type, w);
|
|
1319
1216
|
}
|
|
1320
1217
|
if (obj.id != null) {
|
|
1321
|
-
|
|
1322
|
-
|
|
1218
|
+
w.uint32(18);
|
|
1219
|
+
w.bytes(obj.id);
|
|
1323
1220
|
}
|
|
1324
1221
|
if (obj.protos != null) {
|
|
1325
1222
|
for (const value of obj.protos) {
|
|
1326
|
-
|
|
1327
|
-
|
|
1223
|
+
w.uint32(26);
|
|
1224
|
+
w.string(value);
|
|
1328
1225
|
}
|
|
1329
1226
|
}
|
|
1330
|
-
else {
|
|
1331
|
-
throw new Error('Protocol error: required field "protos" was not found in object');
|
|
1332
|
-
}
|
|
1333
1227
|
if (opts.lengthDelimited !== false) {
|
|
1334
|
-
|
|
1228
|
+
w.ldelim();
|
|
1335
1229
|
}
|
|
1336
1230
|
}, (reader, length) => {
|
|
1337
1231
|
const obj = {
|
|
1338
|
-
type: Type.UNSPECIFIED,
|
|
1339
1232
|
protos: []
|
|
1340
1233
|
};
|
|
1341
1234
|
const end = length == null ? reader.len : reader.pos + length;
|
|
@@ -1356,9 +1249,6 @@ export var PeerstoreRequest;
|
|
|
1356
1249
|
break;
|
|
1357
1250
|
}
|
|
1358
1251
|
}
|
|
1359
|
-
if (obj.type == null) {
|
|
1360
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
1361
|
-
}
|
|
1362
1252
|
return obj;
|
|
1363
1253
|
});
|
|
1364
1254
|
}
|
|
@@ -1376,25 +1266,24 @@ export var PeerstoreResponse;
|
|
|
1376
1266
|
let _codec;
|
|
1377
1267
|
PeerstoreResponse.codec = () => {
|
|
1378
1268
|
if (_codec == null) {
|
|
1379
|
-
_codec = message((obj,
|
|
1269
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1380
1270
|
if (opts.lengthDelimited !== false) {
|
|
1381
|
-
|
|
1271
|
+
w.fork();
|
|
1382
1272
|
}
|
|
1383
1273
|
if (obj.peer != null) {
|
|
1384
|
-
|
|
1385
|
-
PeerInfo.codec().encode(obj.peer,
|
|
1274
|
+
w.uint32(10);
|
|
1275
|
+
PeerInfo.codec().encode(obj.peer, w, {
|
|
1276
|
+
writeDefaults: false
|
|
1277
|
+
});
|
|
1386
1278
|
}
|
|
1387
1279
|
if (obj.protos != null) {
|
|
1388
1280
|
for (const value of obj.protos) {
|
|
1389
|
-
|
|
1390
|
-
|
|
1281
|
+
w.uint32(18);
|
|
1282
|
+
w.string(value);
|
|
1391
1283
|
}
|
|
1392
1284
|
}
|
|
1393
|
-
else {
|
|
1394
|
-
throw new Error('Protocol error: required field "protos" was not found in object');
|
|
1395
|
-
}
|
|
1396
1285
|
if (opts.lengthDelimited !== false) {
|
|
1397
|
-
|
|
1286
|
+
w.ldelim();
|
|
1398
1287
|
}
|
|
1399
1288
|
}, (reader, length) => {
|
|
1400
1289
|
const obj = {
|