@libp2p/daemon-protocol 3.0.1 → 3.0.3
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.map +1 -1
- package/dist/src/index.js +235 -334
- package/dist/src/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +235 -323
package/src/index.ts
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
|
|
|
4
6
|
import { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime'
|
|
5
7
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
@@ -54,60 +56,74 @@ export namespace Request {
|
|
|
54
56
|
|
|
55
57
|
export const codec = (): Codec<Request> => {
|
|
56
58
|
if (_codec == null) {
|
|
57
|
-
_codec = message<Request>((obj,
|
|
59
|
+
_codec = message<Request>((obj, w, opts = {}) => {
|
|
58
60
|
if (opts.lengthDelimited !== false) {
|
|
59
|
-
|
|
61
|
+
w.fork()
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
if (obj.type != null) {
|
|
63
|
-
|
|
64
|
-
Request.Type.codec().encode(obj.type,
|
|
65
|
-
} else {
|
|
66
|
-
throw new Error('Protocol error: required field "type" was not found in object')
|
|
64
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
65
|
+
w.uint32(8)
|
|
66
|
+
Request.Type.codec().encode(obj.type, w)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (obj.connect != null) {
|
|
70
|
-
|
|
71
|
-
ConnectRequest.codec().encode(obj.connect,
|
|
70
|
+
w.uint32(18)
|
|
71
|
+
ConnectRequest.codec().encode(obj.connect, w, {
|
|
72
|
+
writeDefaults: false
|
|
73
|
+
})
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
if (obj.streamOpen != null) {
|
|
75
|
-
|
|
76
|
-
StreamOpenRequest.codec().encode(obj.streamOpen,
|
|
77
|
+
w.uint32(26)
|
|
78
|
+
StreamOpenRequest.codec().encode(obj.streamOpen, w, {
|
|
79
|
+
writeDefaults: false
|
|
80
|
+
})
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
if (obj.streamHandler != null) {
|
|
80
|
-
|
|
81
|
-
StreamHandlerRequest.codec().encode(obj.streamHandler,
|
|
84
|
+
w.uint32(34)
|
|
85
|
+
StreamHandlerRequest.codec().encode(obj.streamHandler, w, {
|
|
86
|
+
writeDefaults: false
|
|
87
|
+
})
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
if (obj.dht != null) {
|
|
85
|
-
|
|
86
|
-
DHTRequest.codec().encode(obj.dht,
|
|
91
|
+
w.uint32(42)
|
|
92
|
+
DHTRequest.codec().encode(obj.dht, w, {
|
|
93
|
+
writeDefaults: false
|
|
94
|
+
})
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
if (obj.connManager != null) {
|
|
90
|
-
|
|
91
|
-
ConnManagerRequest.codec().encode(obj.connManager,
|
|
98
|
+
w.uint32(50)
|
|
99
|
+
ConnManagerRequest.codec().encode(obj.connManager, w, {
|
|
100
|
+
writeDefaults: false
|
|
101
|
+
})
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
if (obj.disconnect != null) {
|
|
95
|
-
|
|
96
|
-
DisconnectRequest.codec().encode(obj.disconnect,
|
|
105
|
+
w.uint32(58)
|
|
106
|
+
DisconnectRequest.codec().encode(obj.disconnect, w, {
|
|
107
|
+
writeDefaults: false
|
|
108
|
+
})
|
|
97
109
|
}
|
|
98
110
|
|
|
99
111
|
if (obj.pubsub != null) {
|
|
100
|
-
|
|
101
|
-
PSRequest.codec().encode(obj.pubsub,
|
|
112
|
+
w.uint32(66)
|
|
113
|
+
PSRequest.codec().encode(obj.pubsub, w, {
|
|
114
|
+
writeDefaults: false
|
|
115
|
+
})
|
|
102
116
|
}
|
|
103
117
|
|
|
104
118
|
if (obj.peerStore != null) {
|
|
105
|
-
|
|
106
|
-
PeerstoreRequest.codec().encode(obj.peerStore,
|
|
119
|
+
w.uint32(74)
|
|
120
|
+
PeerstoreRequest.codec().encode(obj.peerStore, w, {
|
|
121
|
+
writeDefaults: false
|
|
122
|
+
})
|
|
107
123
|
}
|
|
108
124
|
|
|
109
125
|
if (opts.lengthDelimited !== false) {
|
|
110
|
-
|
|
126
|
+
w.ldelim()
|
|
111
127
|
}
|
|
112
128
|
}, (reader, length) => {
|
|
113
129
|
const obj: any = {
|
|
@@ -153,10 +169,6 @@ export namespace Request {
|
|
|
153
169
|
}
|
|
154
170
|
}
|
|
155
171
|
|
|
156
|
-
if (obj.type == null) {
|
|
157
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
158
|
-
}
|
|
159
|
-
|
|
160
172
|
return obj
|
|
161
173
|
})
|
|
162
174
|
}
|
|
@@ -205,59 +217,69 @@ export namespace Response {
|
|
|
205
217
|
|
|
206
218
|
export const codec = (): Codec<Response> => {
|
|
207
219
|
if (_codec == null) {
|
|
208
|
-
_codec = message<Response>((obj,
|
|
220
|
+
_codec = message<Response>((obj, w, opts = {}) => {
|
|
209
221
|
if (opts.lengthDelimited !== false) {
|
|
210
|
-
|
|
222
|
+
w.fork()
|
|
211
223
|
}
|
|
212
224
|
|
|
213
|
-
if (obj.type != null) {
|
|
214
|
-
|
|
215
|
-
Response.Type.codec().encode(obj.type,
|
|
216
|
-
} else {
|
|
217
|
-
throw new Error('Protocol error: required field "type" was not found in object')
|
|
225
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
226
|
+
w.uint32(8)
|
|
227
|
+
Response.Type.codec().encode(obj.type, w)
|
|
218
228
|
}
|
|
219
229
|
|
|
220
230
|
if (obj.error != null) {
|
|
221
|
-
|
|
222
|
-
ErrorResponse.codec().encode(obj.error,
|
|
231
|
+
w.uint32(18)
|
|
232
|
+
ErrorResponse.codec().encode(obj.error, w, {
|
|
233
|
+
writeDefaults: false
|
|
234
|
+
})
|
|
223
235
|
}
|
|
224
236
|
|
|
225
237
|
if (obj.streamInfo != null) {
|
|
226
|
-
|
|
227
|
-
StreamInfo.codec().encode(obj.streamInfo,
|
|
238
|
+
w.uint32(26)
|
|
239
|
+
StreamInfo.codec().encode(obj.streamInfo, w, {
|
|
240
|
+
writeDefaults: false
|
|
241
|
+
})
|
|
228
242
|
}
|
|
229
243
|
|
|
230
244
|
if (obj.identify != null) {
|
|
231
|
-
|
|
232
|
-
IdentifyResponse.codec().encode(obj.identify,
|
|
245
|
+
w.uint32(34)
|
|
246
|
+
IdentifyResponse.codec().encode(obj.identify, w, {
|
|
247
|
+
writeDefaults: false
|
|
248
|
+
})
|
|
233
249
|
}
|
|
234
250
|
|
|
235
251
|
if (obj.dht != null) {
|
|
236
|
-
|
|
237
|
-
DHTResponse.codec().encode(obj.dht,
|
|
252
|
+
w.uint32(42)
|
|
253
|
+
DHTResponse.codec().encode(obj.dht, w, {
|
|
254
|
+
writeDefaults: false
|
|
255
|
+
})
|
|
238
256
|
}
|
|
239
257
|
|
|
240
258
|
if (obj.peers != null) {
|
|
241
259
|
for (const value of obj.peers) {
|
|
242
|
-
|
|
243
|
-
PeerInfo.codec().encode(value,
|
|
260
|
+
w.uint32(50)
|
|
261
|
+
PeerInfo.codec().encode(value, w, {
|
|
262
|
+
writeDefaults: true
|
|
263
|
+
})
|
|
244
264
|
}
|
|
245
|
-
} else {
|
|
246
|
-
throw new Error('Protocol error: required field "peers" was not found in object')
|
|
247
265
|
}
|
|
248
266
|
|
|
249
267
|
if (obj.pubsub != null) {
|
|
250
|
-
|
|
251
|
-
PSResponse.codec().encode(obj.pubsub,
|
|
268
|
+
w.uint32(58)
|
|
269
|
+
PSResponse.codec().encode(obj.pubsub, w, {
|
|
270
|
+
writeDefaults: false
|
|
271
|
+
})
|
|
252
272
|
}
|
|
253
273
|
|
|
254
274
|
if (obj.peerStore != null) {
|
|
255
|
-
|
|
256
|
-
PeerstoreResponse.codec().encode(obj.peerStore,
|
|
275
|
+
w.uint32(66)
|
|
276
|
+
PeerstoreResponse.codec().encode(obj.peerStore, w, {
|
|
277
|
+
writeDefaults: false
|
|
278
|
+
})
|
|
257
279
|
}
|
|
258
280
|
|
|
259
281
|
if (opts.lengthDelimited !== false) {
|
|
260
|
-
|
|
282
|
+
w.ldelim()
|
|
261
283
|
}
|
|
262
284
|
}, (reader, length) => {
|
|
263
285
|
const obj: any = {
|
|
@@ -301,10 +323,6 @@ export namespace Response {
|
|
|
301
323
|
}
|
|
302
324
|
}
|
|
303
325
|
|
|
304
|
-
if (obj.type == null) {
|
|
305
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
306
|
-
}
|
|
307
|
-
|
|
308
326
|
return obj
|
|
309
327
|
})
|
|
310
328
|
}
|
|
@@ -331,29 +349,25 @@ export namespace IdentifyResponse {
|
|
|
331
349
|
|
|
332
350
|
export const codec = (): Codec<IdentifyResponse> => {
|
|
333
351
|
if (_codec == null) {
|
|
334
|
-
_codec = message<IdentifyResponse>((obj,
|
|
352
|
+
_codec = message<IdentifyResponse>((obj, w, opts = {}) => {
|
|
335
353
|
if (opts.lengthDelimited !== false) {
|
|
336
|
-
|
|
354
|
+
w.fork()
|
|
337
355
|
}
|
|
338
356
|
|
|
339
|
-
if (obj.id != null) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
} else {
|
|
343
|
-
throw new Error('Protocol error: required field "id" was not found in object')
|
|
357
|
+
if (opts.writeDefaults === true || (obj.id != null && obj.id.byteLength > 0)) {
|
|
358
|
+
w.uint32(10)
|
|
359
|
+
w.bytes(obj.id)
|
|
344
360
|
}
|
|
345
361
|
|
|
346
362
|
if (obj.addrs != null) {
|
|
347
363
|
for (const value of obj.addrs) {
|
|
348
|
-
|
|
349
|
-
|
|
364
|
+
w.uint32(18)
|
|
365
|
+
w.bytes(value)
|
|
350
366
|
}
|
|
351
|
-
} else {
|
|
352
|
-
throw new Error('Protocol error: required field "addrs" was not found in object')
|
|
353
367
|
}
|
|
354
368
|
|
|
355
369
|
if (opts.lengthDelimited !== false) {
|
|
356
|
-
|
|
370
|
+
w.ldelim()
|
|
357
371
|
}
|
|
358
372
|
}, (reader, length) => {
|
|
359
373
|
const obj: any = {
|
|
@@ -379,10 +393,6 @@ export namespace IdentifyResponse {
|
|
|
379
393
|
}
|
|
380
394
|
}
|
|
381
395
|
|
|
382
|
-
if (obj.id == null) {
|
|
383
|
-
throw new Error('Protocol error: value for required field "id" was not found in protobuf')
|
|
384
|
-
}
|
|
385
|
-
|
|
386
396
|
return obj
|
|
387
397
|
})
|
|
388
398
|
}
|
|
@@ -410,34 +420,30 @@ export namespace ConnectRequest {
|
|
|
410
420
|
|
|
411
421
|
export const codec = (): Codec<ConnectRequest> => {
|
|
412
422
|
if (_codec == null) {
|
|
413
|
-
_codec = message<ConnectRequest>((obj,
|
|
423
|
+
_codec = message<ConnectRequest>((obj, w, opts = {}) => {
|
|
414
424
|
if (opts.lengthDelimited !== false) {
|
|
415
|
-
|
|
425
|
+
w.fork()
|
|
416
426
|
}
|
|
417
427
|
|
|
418
|
-
if (obj.peer != null) {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
} else {
|
|
422
|
-
throw new Error('Protocol error: required field "peer" was not found in object')
|
|
428
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
429
|
+
w.uint32(10)
|
|
430
|
+
w.bytes(obj.peer)
|
|
423
431
|
}
|
|
424
432
|
|
|
425
433
|
if (obj.addrs != null) {
|
|
426
434
|
for (const value of obj.addrs) {
|
|
427
|
-
|
|
428
|
-
|
|
435
|
+
w.uint32(18)
|
|
436
|
+
w.bytes(value)
|
|
429
437
|
}
|
|
430
|
-
} else {
|
|
431
|
-
throw new Error('Protocol error: required field "addrs" was not found in object')
|
|
432
438
|
}
|
|
433
439
|
|
|
434
440
|
if (obj.timeout != null) {
|
|
435
|
-
|
|
436
|
-
|
|
441
|
+
w.uint32(24)
|
|
442
|
+
w.int64(obj.timeout)
|
|
437
443
|
}
|
|
438
444
|
|
|
439
445
|
if (opts.lengthDelimited !== false) {
|
|
440
|
-
|
|
446
|
+
w.ldelim()
|
|
441
447
|
}
|
|
442
448
|
}, (reader, length) => {
|
|
443
449
|
const obj: any = {
|
|
@@ -466,10 +472,6 @@ export namespace ConnectRequest {
|
|
|
466
472
|
}
|
|
467
473
|
}
|
|
468
474
|
|
|
469
|
-
if (obj.peer == null) {
|
|
470
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf')
|
|
471
|
-
}
|
|
472
|
-
|
|
473
475
|
return obj
|
|
474
476
|
})
|
|
475
477
|
}
|
|
@@ -497,34 +499,30 @@ export namespace StreamOpenRequest {
|
|
|
497
499
|
|
|
498
500
|
export const codec = (): Codec<StreamOpenRequest> => {
|
|
499
501
|
if (_codec == null) {
|
|
500
|
-
_codec = message<StreamOpenRequest>((obj,
|
|
502
|
+
_codec = message<StreamOpenRequest>((obj, w, opts = {}) => {
|
|
501
503
|
if (opts.lengthDelimited !== false) {
|
|
502
|
-
|
|
504
|
+
w.fork()
|
|
503
505
|
}
|
|
504
506
|
|
|
505
|
-
if (obj.peer != null) {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
} else {
|
|
509
|
-
throw new Error('Protocol error: required field "peer" was not found in object')
|
|
507
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
508
|
+
w.uint32(10)
|
|
509
|
+
w.bytes(obj.peer)
|
|
510
510
|
}
|
|
511
511
|
|
|
512
512
|
if (obj.proto != null) {
|
|
513
513
|
for (const value of obj.proto) {
|
|
514
|
-
|
|
515
|
-
|
|
514
|
+
w.uint32(18)
|
|
515
|
+
w.string(value)
|
|
516
516
|
}
|
|
517
|
-
} else {
|
|
518
|
-
throw new Error('Protocol error: required field "proto" was not found in object')
|
|
519
517
|
}
|
|
520
518
|
|
|
521
519
|
if (obj.timeout != null) {
|
|
522
|
-
|
|
523
|
-
|
|
520
|
+
w.uint32(24)
|
|
521
|
+
w.int64(obj.timeout)
|
|
524
522
|
}
|
|
525
523
|
|
|
526
524
|
if (opts.lengthDelimited !== false) {
|
|
527
|
-
|
|
525
|
+
w.ldelim()
|
|
528
526
|
}
|
|
529
527
|
}, (reader, length) => {
|
|
530
528
|
const obj: any = {
|
|
@@ -553,10 +551,6 @@ export namespace StreamOpenRequest {
|
|
|
553
551
|
}
|
|
554
552
|
}
|
|
555
553
|
|
|
556
|
-
if (obj.peer == null) {
|
|
557
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf')
|
|
558
|
-
}
|
|
559
|
-
|
|
560
554
|
return obj
|
|
561
555
|
})
|
|
562
556
|
}
|
|
@@ -583,29 +577,25 @@ export namespace StreamHandlerRequest {
|
|
|
583
577
|
|
|
584
578
|
export const codec = (): Codec<StreamHandlerRequest> => {
|
|
585
579
|
if (_codec == null) {
|
|
586
|
-
_codec = message<StreamHandlerRequest>((obj,
|
|
580
|
+
_codec = message<StreamHandlerRequest>((obj, w, opts = {}) => {
|
|
587
581
|
if (opts.lengthDelimited !== false) {
|
|
588
|
-
|
|
582
|
+
w.fork()
|
|
589
583
|
}
|
|
590
584
|
|
|
591
|
-
if (obj.addr != null) {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
} else {
|
|
595
|
-
throw new Error('Protocol error: required field "addr" was not found in object')
|
|
585
|
+
if (opts.writeDefaults === true || (obj.addr != null && obj.addr.byteLength > 0)) {
|
|
586
|
+
w.uint32(10)
|
|
587
|
+
w.bytes(obj.addr)
|
|
596
588
|
}
|
|
597
589
|
|
|
598
590
|
if (obj.proto != null) {
|
|
599
591
|
for (const value of obj.proto) {
|
|
600
|
-
|
|
601
|
-
|
|
592
|
+
w.uint32(18)
|
|
593
|
+
w.string(value)
|
|
602
594
|
}
|
|
603
|
-
} else {
|
|
604
|
-
throw new Error('Protocol error: required field "proto" was not found in object')
|
|
605
595
|
}
|
|
606
596
|
|
|
607
597
|
if (opts.lengthDelimited !== false) {
|
|
608
|
-
|
|
598
|
+
w.ldelim()
|
|
609
599
|
}
|
|
610
600
|
}, (reader, length) => {
|
|
611
601
|
const obj: any = {
|
|
@@ -631,10 +621,6 @@ export namespace StreamHandlerRequest {
|
|
|
631
621
|
}
|
|
632
622
|
}
|
|
633
623
|
|
|
634
|
-
if (obj.addr == null) {
|
|
635
|
-
throw new Error('Protocol error: value for required field "addr" was not found in protobuf')
|
|
636
|
-
}
|
|
637
|
-
|
|
638
624
|
return obj
|
|
639
625
|
})
|
|
640
626
|
}
|
|
@@ -660,20 +646,18 @@ export namespace ErrorResponse {
|
|
|
660
646
|
|
|
661
647
|
export const codec = (): Codec<ErrorResponse> => {
|
|
662
648
|
if (_codec == null) {
|
|
663
|
-
_codec = message<ErrorResponse>((obj,
|
|
649
|
+
_codec = message<ErrorResponse>((obj, w, opts = {}) => {
|
|
664
650
|
if (opts.lengthDelimited !== false) {
|
|
665
|
-
|
|
651
|
+
w.fork()
|
|
666
652
|
}
|
|
667
653
|
|
|
668
|
-
if (obj.msg
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
} else {
|
|
672
|
-
throw new Error('Protocol error: required field "msg" was not found in object')
|
|
654
|
+
if (opts.writeDefaults === true || obj.msg !== '') {
|
|
655
|
+
w.uint32(10)
|
|
656
|
+
w.string(obj.msg)
|
|
673
657
|
}
|
|
674
658
|
|
|
675
659
|
if (opts.lengthDelimited !== false) {
|
|
676
|
-
|
|
660
|
+
w.ldelim()
|
|
677
661
|
}
|
|
678
662
|
}, (reader, length) => {
|
|
679
663
|
const obj: any = {
|
|
@@ -695,10 +679,6 @@ export namespace ErrorResponse {
|
|
|
695
679
|
}
|
|
696
680
|
}
|
|
697
681
|
|
|
698
|
-
if (obj.msg == null) {
|
|
699
|
-
throw new Error('Protocol error: value for required field "msg" was not found in protobuf')
|
|
700
|
-
}
|
|
701
|
-
|
|
702
682
|
return obj
|
|
703
683
|
})
|
|
704
684
|
}
|
|
@@ -726,34 +706,28 @@ export namespace StreamInfo {
|
|
|
726
706
|
|
|
727
707
|
export const codec = (): Codec<StreamInfo> => {
|
|
728
708
|
if (_codec == null) {
|
|
729
|
-
_codec = message<StreamInfo>((obj,
|
|
709
|
+
_codec = message<StreamInfo>((obj, w, opts = {}) => {
|
|
730
710
|
if (opts.lengthDelimited !== false) {
|
|
731
|
-
|
|
711
|
+
w.fork()
|
|
732
712
|
}
|
|
733
713
|
|
|
734
|
-
if (obj.peer != null) {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
} else {
|
|
738
|
-
throw new Error('Protocol error: required field "peer" was not found in object')
|
|
714
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
715
|
+
w.uint32(10)
|
|
716
|
+
w.bytes(obj.peer)
|
|
739
717
|
}
|
|
740
718
|
|
|
741
|
-
if (obj.addr != null) {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
} else {
|
|
745
|
-
throw new Error('Protocol error: required field "addr" was not found in object')
|
|
719
|
+
if (opts.writeDefaults === true || (obj.addr != null && obj.addr.byteLength > 0)) {
|
|
720
|
+
w.uint32(18)
|
|
721
|
+
w.bytes(obj.addr)
|
|
746
722
|
}
|
|
747
723
|
|
|
748
|
-
if (obj.proto
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
} else {
|
|
752
|
-
throw new Error('Protocol error: required field "proto" was not found in object')
|
|
724
|
+
if (opts.writeDefaults === true || obj.proto !== '') {
|
|
725
|
+
w.uint32(26)
|
|
726
|
+
w.string(obj.proto)
|
|
753
727
|
}
|
|
754
728
|
|
|
755
729
|
if (opts.lengthDelimited !== false) {
|
|
756
|
-
|
|
730
|
+
w.ldelim()
|
|
757
731
|
}
|
|
758
732
|
}, (reader, length) => {
|
|
759
733
|
const obj: any = {
|
|
@@ -783,18 +757,6 @@ export namespace StreamInfo {
|
|
|
783
757
|
}
|
|
784
758
|
}
|
|
785
759
|
|
|
786
|
-
if (obj.peer == null) {
|
|
787
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf')
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
if (obj.addr == null) {
|
|
791
|
-
throw new Error('Protocol error: value for required field "addr" was not found in protobuf')
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
if (obj.proto == null) {
|
|
795
|
-
throw new Error('Protocol error: value for required field "proto" was not found in protobuf')
|
|
796
|
-
}
|
|
797
|
-
|
|
798
760
|
return obj
|
|
799
761
|
})
|
|
800
762
|
}
|
|
@@ -856,50 +818,48 @@ export namespace DHTRequest {
|
|
|
856
818
|
|
|
857
819
|
export const codec = (): Codec<DHTRequest> => {
|
|
858
820
|
if (_codec == null) {
|
|
859
|
-
_codec = message<DHTRequest>((obj,
|
|
821
|
+
_codec = message<DHTRequest>((obj, w, opts = {}) => {
|
|
860
822
|
if (opts.lengthDelimited !== false) {
|
|
861
|
-
|
|
823
|
+
w.fork()
|
|
862
824
|
}
|
|
863
825
|
|
|
864
|
-
if (obj.type != null) {
|
|
865
|
-
|
|
866
|
-
DHTRequest.Type.codec().encode(obj.type,
|
|
867
|
-
} else {
|
|
868
|
-
throw new Error('Protocol error: required field "type" was not found in object')
|
|
826
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
827
|
+
w.uint32(8)
|
|
828
|
+
DHTRequest.Type.codec().encode(obj.type, w)
|
|
869
829
|
}
|
|
870
830
|
|
|
871
831
|
if (obj.peer != null) {
|
|
872
|
-
|
|
873
|
-
|
|
832
|
+
w.uint32(18)
|
|
833
|
+
w.bytes(obj.peer)
|
|
874
834
|
}
|
|
875
835
|
|
|
876
836
|
if (obj.cid != null) {
|
|
877
|
-
|
|
878
|
-
|
|
837
|
+
w.uint32(26)
|
|
838
|
+
w.bytes(obj.cid)
|
|
879
839
|
}
|
|
880
840
|
|
|
881
841
|
if (obj.key != null) {
|
|
882
|
-
|
|
883
|
-
|
|
842
|
+
w.uint32(34)
|
|
843
|
+
w.bytes(obj.key)
|
|
884
844
|
}
|
|
885
845
|
|
|
886
846
|
if (obj.value != null) {
|
|
887
|
-
|
|
888
|
-
|
|
847
|
+
w.uint32(42)
|
|
848
|
+
w.bytes(obj.value)
|
|
889
849
|
}
|
|
890
850
|
|
|
891
851
|
if (obj.count != null) {
|
|
892
|
-
|
|
893
|
-
|
|
852
|
+
w.uint32(48)
|
|
853
|
+
w.int32(obj.count)
|
|
894
854
|
}
|
|
895
855
|
|
|
896
856
|
if (obj.timeout != null) {
|
|
897
|
-
|
|
898
|
-
|
|
857
|
+
w.uint32(56)
|
|
858
|
+
w.int64(obj.timeout)
|
|
899
859
|
}
|
|
900
860
|
|
|
901
861
|
if (opts.lengthDelimited !== false) {
|
|
902
|
-
|
|
862
|
+
w.ldelim()
|
|
903
863
|
}
|
|
904
864
|
}, (reader, length) => {
|
|
905
865
|
const obj: any = {
|
|
@@ -939,10 +899,6 @@ export namespace DHTRequest {
|
|
|
939
899
|
}
|
|
940
900
|
}
|
|
941
901
|
|
|
942
|
-
if (obj.type == null) {
|
|
943
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
944
|
-
}
|
|
945
|
-
|
|
946
902
|
return obj
|
|
947
903
|
})
|
|
948
904
|
}
|
|
@@ -988,30 +944,30 @@ export namespace DHTResponse {
|
|
|
988
944
|
|
|
989
945
|
export const codec = (): Codec<DHTResponse> => {
|
|
990
946
|
if (_codec == null) {
|
|
991
|
-
_codec = message<DHTResponse>((obj,
|
|
947
|
+
_codec = message<DHTResponse>((obj, w, opts = {}) => {
|
|
992
948
|
if (opts.lengthDelimited !== false) {
|
|
993
|
-
|
|
949
|
+
w.fork()
|
|
994
950
|
}
|
|
995
951
|
|
|
996
|
-
if (obj.type != null) {
|
|
997
|
-
|
|
998
|
-
DHTResponse.Type.codec().encode(obj.type,
|
|
999
|
-
} else {
|
|
1000
|
-
throw new Error('Protocol error: required field "type" was not found in object')
|
|
952
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
953
|
+
w.uint32(8)
|
|
954
|
+
DHTResponse.Type.codec().encode(obj.type, w)
|
|
1001
955
|
}
|
|
1002
956
|
|
|
1003
957
|
if (obj.peer != null) {
|
|
1004
|
-
|
|
1005
|
-
PeerInfo.codec().encode(obj.peer,
|
|
958
|
+
w.uint32(18)
|
|
959
|
+
PeerInfo.codec().encode(obj.peer, w, {
|
|
960
|
+
writeDefaults: false
|
|
961
|
+
})
|
|
1006
962
|
}
|
|
1007
963
|
|
|
1008
964
|
if (obj.value != null) {
|
|
1009
|
-
|
|
1010
|
-
|
|
965
|
+
w.uint32(26)
|
|
966
|
+
w.bytes(obj.value)
|
|
1011
967
|
}
|
|
1012
968
|
|
|
1013
969
|
if (opts.lengthDelimited !== false) {
|
|
1014
|
-
|
|
970
|
+
w.ldelim()
|
|
1015
971
|
}
|
|
1016
972
|
}, (reader, length) => {
|
|
1017
973
|
const obj: any = {
|
|
@@ -1039,10 +995,6 @@ export namespace DHTResponse {
|
|
|
1039
995
|
}
|
|
1040
996
|
}
|
|
1041
997
|
|
|
1042
|
-
if (obj.type == null) {
|
|
1043
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
998
|
return obj
|
|
1047
999
|
})
|
|
1048
1000
|
}
|
|
@@ -1069,29 +1021,25 @@ export namespace PeerInfo {
|
|
|
1069
1021
|
|
|
1070
1022
|
export const codec = (): Codec<PeerInfo> => {
|
|
1071
1023
|
if (_codec == null) {
|
|
1072
|
-
_codec = message<PeerInfo>((obj,
|
|
1024
|
+
_codec = message<PeerInfo>((obj, w, opts = {}) => {
|
|
1073
1025
|
if (opts.lengthDelimited !== false) {
|
|
1074
|
-
|
|
1026
|
+
w.fork()
|
|
1075
1027
|
}
|
|
1076
1028
|
|
|
1077
|
-
if (obj.id != null) {
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
} else {
|
|
1081
|
-
throw new Error('Protocol error: required field "id" was not found in object')
|
|
1029
|
+
if (opts.writeDefaults === true || (obj.id != null && obj.id.byteLength > 0)) {
|
|
1030
|
+
w.uint32(10)
|
|
1031
|
+
w.bytes(obj.id)
|
|
1082
1032
|
}
|
|
1083
1033
|
|
|
1084
1034
|
if (obj.addrs != null) {
|
|
1085
1035
|
for (const value of obj.addrs) {
|
|
1086
|
-
|
|
1087
|
-
|
|
1036
|
+
w.uint32(18)
|
|
1037
|
+
w.bytes(value)
|
|
1088
1038
|
}
|
|
1089
|
-
} else {
|
|
1090
|
-
throw new Error('Protocol error: required field "addrs" was not found in object')
|
|
1091
1039
|
}
|
|
1092
1040
|
|
|
1093
1041
|
if (opts.lengthDelimited !== false) {
|
|
1094
|
-
|
|
1042
|
+
w.ldelim()
|
|
1095
1043
|
}
|
|
1096
1044
|
}, (reader, length) => {
|
|
1097
1045
|
const obj: any = {
|
|
@@ -1117,10 +1065,6 @@ export namespace PeerInfo {
|
|
|
1117
1065
|
}
|
|
1118
1066
|
}
|
|
1119
1067
|
|
|
1120
|
-
if (obj.id == null) {
|
|
1121
|
-
throw new Error('Protocol error: value for required field "id" was not found in protobuf')
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
1068
|
return obj
|
|
1125
1069
|
})
|
|
1126
1070
|
}
|
|
@@ -1167,35 +1111,33 @@ export namespace ConnManagerRequest {
|
|
|
1167
1111
|
|
|
1168
1112
|
export const codec = (): Codec<ConnManagerRequest> => {
|
|
1169
1113
|
if (_codec == null) {
|
|
1170
|
-
_codec = message<ConnManagerRequest>((obj,
|
|
1114
|
+
_codec = message<ConnManagerRequest>((obj, w, opts = {}) => {
|
|
1171
1115
|
if (opts.lengthDelimited !== false) {
|
|
1172
|
-
|
|
1116
|
+
w.fork()
|
|
1173
1117
|
}
|
|
1174
1118
|
|
|
1175
|
-
if (obj.type != null) {
|
|
1176
|
-
|
|
1177
|
-
ConnManagerRequest.Type.codec().encode(obj.type,
|
|
1178
|
-
} else {
|
|
1179
|
-
throw new Error('Protocol error: required field "type" was not found in object')
|
|
1119
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
1120
|
+
w.uint32(8)
|
|
1121
|
+
ConnManagerRequest.Type.codec().encode(obj.type, w)
|
|
1180
1122
|
}
|
|
1181
1123
|
|
|
1182
1124
|
if (obj.peer != null) {
|
|
1183
|
-
|
|
1184
|
-
|
|
1125
|
+
w.uint32(18)
|
|
1126
|
+
w.bytes(obj.peer)
|
|
1185
1127
|
}
|
|
1186
1128
|
|
|
1187
1129
|
if (obj.tag != null) {
|
|
1188
|
-
|
|
1189
|
-
|
|
1130
|
+
w.uint32(26)
|
|
1131
|
+
w.string(obj.tag)
|
|
1190
1132
|
}
|
|
1191
1133
|
|
|
1192
1134
|
if (obj.weight != null) {
|
|
1193
|
-
|
|
1194
|
-
|
|
1135
|
+
w.uint32(32)
|
|
1136
|
+
w.int64(obj.weight)
|
|
1195
1137
|
}
|
|
1196
1138
|
|
|
1197
1139
|
if (opts.lengthDelimited !== false) {
|
|
1198
|
-
|
|
1140
|
+
w.ldelim()
|
|
1199
1141
|
}
|
|
1200
1142
|
}, (reader, length) => {
|
|
1201
1143
|
const obj: any = {
|
|
@@ -1226,10 +1168,6 @@ export namespace ConnManagerRequest {
|
|
|
1226
1168
|
}
|
|
1227
1169
|
}
|
|
1228
1170
|
|
|
1229
|
-
if (obj.type == null) {
|
|
1230
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
1171
|
return obj
|
|
1234
1172
|
})
|
|
1235
1173
|
}
|
|
@@ -1255,20 +1193,18 @@ export namespace DisconnectRequest {
|
|
|
1255
1193
|
|
|
1256
1194
|
export const codec = (): Codec<DisconnectRequest> => {
|
|
1257
1195
|
if (_codec == null) {
|
|
1258
|
-
_codec = message<DisconnectRequest>((obj,
|
|
1196
|
+
_codec = message<DisconnectRequest>((obj, w, opts = {}) => {
|
|
1259
1197
|
if (opts.lengthDelimited !== false) {
|
|
1260
|
-
|
|
1198
|
+
w.fork()
|
|
1261
1199
|
}
|
|
1262
1200
|
|
|
1263
|
-
if (obj.peer != null) {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
} else {
|
|
1267
|
-
throw new Error('Protocol error: required field "peer" was not found in object')
|
|
1201
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
1202
|
+
w.uint32(10)
|
|
1203
|
+
w.bytes(obj.peer)
|
|
1268
1204
|
}
|
|
1269
1205
|
|
|
1270
1206
|
if (opts.lengthDelimited !== false) {
|
|
1271
|
-
|
|
1207
|
+
w.ldelim()
|
|
1272
1208
|
}
|
|
1273
1209
|
}, (reader, length) => {
|
|
1274
1210
|
const obj: any = {
|
|
@@ -1290,10 +1226,6 @@ export namespace DisconnectRequest {
|
|
|
1290
1226
|
}
|
|
1291
1227
|
}
|
|
1292
1228
|
|
|
1293
|
-
if (obj.peer == null) {
|
|
1294
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf')
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
1229
|
return obj
|
|
1298
1230
|
})
|
|
1299
1231
|
}
|
|
@@ -1341,30 +1273,28 @@ export namespace PSRequest {
|
|
|
1341
1273
|
|
|
1342
1274
|
export const codec = (): Codec<PSRequest> => {
|
|
1343
1275
|
if (_codec == null) {
|
|
1344
|
-
_codec = message<PSRequest>((obj,
|
|
1276
|
+
_codec = message<PSRequest>((obj, w, opts = {}) => {
|
|
1345
1277
|
if (opts.lengthDelimited !== false) {
|
|
1346
|
-
|
|
1278
|
+
w.fork()
|
|
1347
1279
|
}
|
|
1348
1280
|
|
|
1349
|
-
if (obj.type != null) {
|
|
1350
|
-
|
|
1351
|
-
PSRequest.Type.codec().encode(obj.type,
|
|
1352
|
-
} else {
|
|
1353
|
-
throw new Error('Protocol error: required field "type" was not found in object')
|
|
1281
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
1282
|
+
w.uint32(8)
|
|
1283
|
+
PSRequest.Type.codec().encode(obj.type, w)
|
|
1354
1284
|
}
|
|
1355
1285
|
|
|
1356
1286
|
if (obj.topic != null) {
|
|
1357
|
-
|
|
1358
|
-
|
|
1287
|
+
w.uint32(18)
|
|
1288
|
+
w.string(obj.topic)
|
|
1359
1289
|
}
|
|
1360
1290
|
|
|
1361
1291
|
if (obj.data != null) {
|
|
1362
|
-
|
|
1363
|
-
|
|
1292
|
+
w.uint32(26)
|
|
1293
|
+
w.bytes(obj.data)
|
|
1364
1294
|
}
|
|
1365
1295
|
|
|
1366
1296
|
if (opts.lengthDelimited !== false) {
|
|
1367
|
-
|
|
1297
|
+
w.ldelim()
|
|
1368
1298
|
}
|
|
1369
1299
|
}, (reader, length) => {
|
|
1370
1300
|
const obj: any = {
|
|
@@ -1392,10 +1322,6 @@ export namespace PSRequest {
|
|
|
1392
1322
|
}
|
|
1393
1323
|
}
|
|
1394
1324
|
|
|
1395
|
-
if (obj.type == null) {
|
|
1396
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
1325
|
return obj
|
|
1400
1326
|
})
|
|
1401
1327
|
}
|
|
@@ -1426,47 +1352,45 @@ export namespace PSMessage {
|
|
|
1426
1352
|
|
|
1427
1353
|
export const codec = (): Codec<PSMessage> => {
|
|
1428
1354
|
if (_codec == null) {
|
|
1429
|
-
_codec = message<PSMessage>((obj,
|
|
1355
|
+
_codec = message<PSMessage>((obj, w, opts = {}) => {
|
|
1430
1356
|
if (opts.lengthDelimited !== false) {
|
|
1431
|
-
|
|
1357
|
+
w.fork()
|
|
1432
1358
|
}
|
|
1433
1359
|
|
|
1434
1360
|
if (obj.from != null) {
|
|
1435
|
-
|
|
1436
|
-
|
|
1361
|
+
w.uint32(10)
|
|
1362
|
+
w.bytes(obj.from)
|
|
1437
1363
|
}
|
|
1438
1364
|
|
|
1439
1365
|
if (obj.data != null) {
|
|
1440
|
-
|
|
1441
|
-
|
|
1366
|
+
w.uint32(18)
|
|
1367
|
+
w.bytes(obj.data)
|
|
1442
1368
|
}
|
|
1443
1369
|
|
|
1444
1370
|
if (obj.seqno != null) {
|
|
1445
|
-
|
|
1446
|
-
|
|
1371
|
+
w.uint32(26)
|
|
1372
|
+
w.bytes(obj.seqno)
|
|
1447
1373
|
}
|
|
1448
1374
|
|
|
1449
1375
|
if (obj.topicIDs != null) {
|
|
1450
1376
|
for (const value of obj.topicIDs) {
|
|
1451
|
-
|
|
1452
|
-
|
|
1377
|
+
w.uint32(34)
|
|
1378
|
+
w.string(value)
|
|
1453
1379
|
}
|
|
1454
|
-
} else {
|
|
1455
|
-
throw new Error('Protocol error: required field "topicIDs" was not found in object')
|
|
1456
1380
|
}
|
|
1457
1381
|
|
|
1458
1382
|
if (obj.signature != null) {
|
|
1459
|
-
|
|
1460
|
-
|
|
1383
|
+
w.uint32(42)
|
|
1384
|
+
w.bytes(obj.signature)
|
|
1461
1385
|
}
|
|
1462
1386
|
|
|
1463
1387
|
if (obj.key != null) {
|
|
1464
|
-
|
|
1465
|
-
|
|
1388
|
+
w.uint32(50)
|
|
1389
|
+
w.bytes(obj.key)
|
|
1466
1390
|
}
|
|
1467
1391
|
|
|
1468
1392
|
if (opts.lengthDelimited !== false) {
|
|
1469
|
-
|
|
1393
|
+
w.ldelim()
|
|
1470
1394
|
}
|
|
1471
1395
|
}, (reader, length) => {
|
|
1472
1396
|
const obj: any = {
|
|
@@ -1529,31 +1453,27 @@ export namespace PSResponse {
|
|
|
1529
1453
|
|
|
1530
1454
|
export const codec = (): Codec<PSResponse> => {
|
|
1531
1455
|
if (_codec == null) {
|
|
1532
|
-
_codec = message<PSResponse>((obj,
|
|
1456
|
+
_codec = message<PSResponse>((obj, w, opts = {}) => {
|
|
1533
1457
|
if (opts.lengthDelimited !== false) {
|
|
1534
|
-
|
|
1458
|
+
w.fork()
|
|
1535
1459
|
}
|
|
1536
1460
|
|
|
1537
1461
|
if (obj.topics != null) {
|
|
1538
1462
|
for (const value of obj.topics) {
|
|
1539
|
-
|
|
1540
|
-
|
|
1463
|
+
w.uint32(10)
|
|
1464
|
+
w.string(value)
|
|
1541
1465
|
}
|
|
1542
|
-
} else {
|
|
1543
|
-
throw new Error('Protocol error: required field "topics" was not found in object')
|
|
1544
1466
|
}
|
|
1545
1467
|
|
|
1546
1468
|
if (obj.peerIDs != null) {
|
|
1547
1469
|
for (const value of obj.peerIDs) {
|
|
1548
|
-
|
|
1549
|
-
|
|
1470
|
+
w.uint32(18)
|
|
1471
|
+
w.bytes(value)
|
|
1550
1472
|
}
|
|
1551
|
-
} else {
|
|
1552
|
-
throw new Error('Protocol error: required field "peerIDs" was not found in object')
|
|
1553
1473
|
}
|
|
1554
1474
|
|
|
1555
1475
|
if (opts.lengthDelimited !== false) {
|
|
1556
|
-
|
|
1476
|
+
w.ldelim()
|
|
1557
1477
|
}
|
|
1558
1478
|
}, (reader, length) => {
|
|
1559
1479
|
const obj: any = {
|
|
@@ -1624,34 +1544,30 @@ export namespace PeerstoreRequest {
|
|
|
1624
1544
|
|
|
1625
1545
|
export const codec = (): Codec<PeerstoreRequest> => {
|
|
1626
1546
|
if (_codec == null) {
|
|
1627
|
-
_codec = message<PeerstoreRequest>((obj,
|
|
1547
|
+
_codec = message<PeerstoreRequest>((obj, w, opts = {}) => {
|
|
1628
1548
|
if (opts.lengthDelimited !== false) {
|
|
1629
|
-
|
|
1549
|
+
w.fork()
|
|
1630
1550
|
}
|
|
1631
1551
|
|
|
1632
|
-
if (obj.type != null) {
|
|
1633
|
-
|
|
1634
|
-
PeerstoreRequest.Type.codec().encode(obj.type,
|
|
1635
|
-
} else {
|
|
1636
|
-
throw new Error('Protocol error: required field "type" was not found in object')
|
|
1552
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
1553
|
+
w.uint32(8)
|
|
1554
|
+
PeerstoreRequest.Type.codec().encode(obj.type, w)
|
|
1637
1555
|
}
|
|
1638
1556
|
|
|
1639
1557
|
if (obj.id != null) {
|
|
1640
|
-
|
|
1641
|
-
|
|
1558
|
+
w.uint32(18)
|
|
1559
|
+
w.bytes(obj.id)
|
|
1642
1560
|
}
|
|
1643
1561
|
|
|
1644
1562
|
if (obj.protos != null) {
|
|
1645
1563
|
for (const value of obj.protos) {
|
|
1646
|
-
|
|
1647
|
-
|
|
1564
|
+
w.uint32(26)
|
|
1565
|
+
w.string(value)
|
|
1648
1566
|
}
|
|
1649
|
-
} else {
|
|
1650
|
-
throw new Error('Protocol error: required field "protos" was not found in object')
|
|
1651
1567
|
}
|
|
1652
1568
|
|
|
1653
1569
|
if (opts.lengthDelimited !== false) {
|
|
1654
|
-
|
|
1570
|
+
w.ldelim()
|
|
1655
1571
|
}
|
|
1656
1572
|
}, (reader, length) => {
|
|
1657
1573
|
const obj: any = {
|
|
@@ -1680,10 +1596,6 @@ export namespace PeerstoreRequest {
|
|
|
1680
1596
|
}
|
|
1681
1597
|
}
|
|
1682
1598
|
|
|
1683
|
-
if (obj.type == null) {
|
|
1684
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
1599
|
return obj
|
|
1688
1600
|
})
|
|
1689
1601
|
}
|
|
@@ -1710,27 +1622,27 @@ export namespace PeerstoreResponse {
|
|
|
1710
1622
|
|
|
1711
1623
|
export const codec = (): Codec<PeerstoreResponse> => {
|
|
1712
1624
|
if (_codec == null) {
|
|
1713
|
-
_codec = message<PeerstoreResponse>((obj,
|
|
1625
|
+
_codec = message<PeerstoreResponse>((obj, w, opts = {}) => {
|
|
1714
1626
|
if (opts.lengthDelimited !== false) {
|
|
1715
|
-
|
|
1627
|
+
w.fork()
|
|
1716
1628
|
}
|
|
1717
1629
|
|
|
1718
1630
|
if (obj.peer != null) {
|
|
1719
|
-
|
|
1720
|
-
PeerInfo.codec().encode(obj.peer,
|
|
1631
|
+
w.uint32(10)
|
|
1632
|
+
PeerInfo.codec().encode(obj.peer, w, {
|
|
1633
|
+
writeDefaults: false
|
|
1634
|
+
})
|
|
1721
1635
|
}
|
|
1722
1636
|
|
|
1723
1637
|
if (obj.protos != null) {
|
|
1724
1638
|
for (const value of obj.protos) {
|
|
1725
|
-
|
|
1726
|
-
|
|
1639
|
+
w.uint32(18)
|
|
1640
|
+
w.string(value)
|
|
1727
1641
|
}
|
|
1728
|
-
} else {
|
|
1729
|
-
throw new Error('Protocol error: required field "protos" was not found in object')
|
|
1730
1642
|
}
|
|
1731
1643
|
|
|
1732
1644
|
if (opts.lengthDelimited !== false) {
|
|
1733
|
-
|
|
1645
|
+
w.ldelim()
|
|
1734
1646
|
}
|
|
1735
1647
|
}, (reader, length) => {
|
|
1736
1648
|
const obj: any = {
|