@libp2p/daemon-protocol 1.0.6 → 2.0.2
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 +18 -8
- package/dist/src/index.d.ts +26 -25
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1093 -101
- package/dist/src/index.js.map +1 -1
- package/dist/src/stream-handler.d.ts +3 -2
- package/dist/src/stream-handler.d.ts.map +1 -1
- package/dist/src/stream-handler.js +1 -1
- package/dist/src/stream-handler.js.map +1 -1
- package/dist/src/upgrader.d.ts +1 -1
- package/dist/src/upgrader.d.ts.map +1 -1
- package/package.json +19 -9
- package/src/index.ts +1319 -126
- package/src/stream-handler.ts +4 -3
- package/src/upgrader.ts +1 -1
- package/dist/index.min.js +0 -17
package/src/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
3
|
|
|
4
|
-
import { enumeration, encodeMessage, decodeMessage, message
|
|
4
|
+
import { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime'
|
|
5
|
+
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
5
6
|
import type { Codec } from 'protons-runtime'
|
|
6
7
|
|
|
7
8
|
export interface Request {
|
|
@@ -45,29 +46,127 @@ export namespace Request {
|
|
|
45
46
|
|
|
46
47
|
export namespace Type {
|
|
47
48
|
export const codec = () => {
|
|
48
|
-
return enumeration<
|
|
49
|
+
return enumeration<Type>(__TypeValues)
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
let _codec: Codec<Request>
|
|
54
|
+
|
|
52
55
|
export const codec = (): Codec<Request> => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
if (_codec == null) {
|
|
57
|
+
_codec = message<Request>((obj, writer, opts = {}) => {
|
|
58
|
+
if (opts.lengthDelimited !== false) {
|
|
59
|
+
writer.fork()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (obj.type != null) {
|
|
63
|
+
writer.uint32(8)
|
|
64
|
+
Request.Type.codec().encode(obj.type, writer)
|
|
65
|
+
} else {
|
|
66
|
+
throw new Error('Protocol error: required field "type" was not found in object')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (obj.connect != null) {
|
|
70
|
+
writer.uint32(18)
|
|
71
|
+
ConnectRequest.codec().encode(obj.connect, writer)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (obj.streamOpen != null) {
|
|
75
|
+
writer.uint32(26)
|
|
76
|
+
StreamOpenRequest.codec().encode(obj.streamOpen, writer)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (obj.streamHandler != null) {
|
|
80
|
+
writer.uint32(34)
|
|
81
|
+
StreamHandlerRequest.codec().encode(obj.streamHandler, writer)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (obj.dht != null) {
|
|
85
|
+
writer.uint32(42)
|
|
86
|
+
DHTRequest.codec().encode(obj.dht, writer)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (obj.connManager != null) {
|
|
90
|
+
writer.uint32(50)
|
|
91
|
+
ConnManagerRequest.codec().encode(obj.connManager, writer)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (obj.disconnect != null) {
|
|
95
|
+
writer.uint32(58)
|
|
96
|
+
DisconnectRequest.codec().encode(obj.disconnect, writer)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (obj.pubsub != null) {
|
|
100
|
+
writer.uint32(66)
|
|
101
|
+
PSRequest.codec().encode(obj.pubsub, writer)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (obj.peerStore != null) {
|
|
105
|
+
writer.uint32(74)
|
|
106
|
+
PeerstoreRequest.codec().encode(obj.peerStore, writer)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (opts.lengthDelimited !== false) {
|
|
110
|
+
writer.ldelim()
|
|
111
|
+
}
|
|
112
|
+
}, (reader, length) => {
|
|
113
|
+
const obj: any = {}
|
|
114
|
+
|
|
115
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
116
|
+
|
|
117
|
+
while (reader.pos < end) {
|
|
118
|
+
const tag = reader.uint32()
|
|
119
|
+
|
|
120
|
+
switch (tag >>> 3) {
|
|
121
|
+
case 1:
|
|
122
|
+
obj.type = Request.Type.codec().decode(reader)
|
|
123
|
+
break
|
|
124
|
+
case 2:
|
|
125
|
+
obj.connect = ConnectRequest.codec().decode(reader, reader.uint32())
|
|
126
|
+
break
|
|
127
|
+
case 3:
|
|
128
|
+
obj.streamOpen = StreamOpenRequest.codec().decode(reader, reader.uint32())
|
|
129
|
+
break
|
|
130
|
+
case 4:
|
|
131
|
+
obj.streamHandler = StreamHandlerRequest.codec().decode(reader, reader.uint32())
|
|
132
|
+
break
|
|
133
|
+
case 5:
|
|
134
|
+
obj.dht = DHTRequest.codec().decode(reader, reader.uint32())
|
|
135
|
+
break
|
|
136
|
+
case 6:
|
|
137
|
+
obj.connManager = ConnManagerRequest.codec().decode(reader, reader.uint32())
|
|
138
|
+
break
|
|
139
|
+
case 7:
|
|
140
|
+
obj.disconnect = DisconnectRequest.codec().decode(reader, reader.uint32())
|
|
141
|
+
break
|
|
142
|
+
case 8:
|
|
143
|
+
obj.pubsub = PSRequest.codec().decode(reader, reader.uint32())
|
|
144
|
+
break
|
|
145
|
+
case 9:
|
|
146
|
+
obj.peerStore = PeerstoreRequest.codec().decode(reader, reader.uint32())
|
|
147
|
+
break
|
|
148
|
+
default:
|
|
149
|
+
reader.skipType(tag & 7)
|
|
150
|
+
break
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (obj.type == null) {
|
|
155
|
+
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return obj
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return _codec
|
|
64
163
|
}
|
|
65
164
|
|
|
66
165
|
export const encode = (obj: Request): Uint8Array => {
|
|
67
166
|
return encodeMessage(obj, Request.codec())
|
|
68
167
|
}
|
|
69
168
|
|
|
70
|
-
export const decode = (buf: Uint8Array): Request => {
|
|
169
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): Request => {
|
|
71
170
|
return decodeMessage(buf, Request.codec())
|
|
72
171
|
}
|
|
73
172
|
}
|
|
@@ -96,28 +195,130 @@ export namespace Response {
|
|
|
96
195
|
|
|
97
196
|
export namespace Type {
|
|
98
197
|
export const codec = () => {
|
|
99
|
-
return enumeration<
|
|
198
|
+
return enumeration<Type>(__TypeValues)
|
|
100
199
|
}
|
|
101
200
|
}
|
|
102
201
|
|
|
202
|
+
let _codec: Codec<Response>
|
|
203
|
+
|
|
103
204
|
export const codec = (): Codec<Response> => {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
205
|
+
if (_codec == null) {
|
|
206
|
+
_codec = message<Response>((obj, writer, opts = {}) => {
|
|
207
|
+
if (opts.lengthDelimited !== false) {
|
|
208
|
+
writer.fork()
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (obj.type != null) {
|
|
212
|
+
writer.uint32(8)
|
|
213
|
+
Response.Type.codec().encode(obj.type, writer)
|
|
214
|
+
} else {
|
|
215
|
+
throw new Error('Protocol error: required field "type" was not found in object')
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (obj.error != null) {
|
|
219
|
+
writer.uint32(18)
|
|
220
|
+
ErrorResponse.codec().encode(obj.error, writer)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (obj.streamInfo != null) {
|
|
224
|
+
writer.uint32(26)
|
|
225
|
+
StreamInfo.codec().encode(obj.streamInfo, writer)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (obj.identify != null) {
|
|
229
|
+
writer.uint32(34)
|
|
230
|
+
IdentifyResponse.codec().encode(obj.identify, writer)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (obj.dht != null) {
|
|
234
|
+
writer.uint32(42)
|
|
235
|
+
DHTResponse.codec().encode(obj.dht, writer)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (obj.peers != null) {
|
|
239
|
+
for (const value of obj.peers) {
|
|
240
|
+
writer.uint32(50)
|
|
241
|
+
PeerInfo.codec().encode(value, writer)
|
|
242
|
+
}
|
|
243
|
+
} else {
|
|
244
|
+
throw new Error('Protocol error: required field "peers" was not found in object')
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (obj.pubsub != null) {
|
|
248
|
+
writer.uint32(58)
|
|
249
|
+
PSResponse.codec().encode(obj.pubsub, writer)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (obj.peerStore != null) {
|
|
253
|
+
writer.uint32(66)
|
|
254
|
+
PeerstoreResponse.codec().encode(obj.peerStore, writer)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (opts.lengthDelimited !== false) {
|
|
258
|
+
writer.ldelim()
|
|
259
|
+
}
|
|
260
|
+
}, (reader, length) => {
|
|
261
|
+
const obj: any = {}
|
|
262
|
+
|
|
263
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
264
|
+
|
|
265
|
+
while (reader.pos < end) {
|
|
266
|
+
const tag = reader.uint32()
|
|
267
|
+
|
|
268
|
+
switch (tag >>> 3) {
|
|
269
|
+
case 1:
|
|
270
|
+
obj.type = Response.Type.codec().decode(reader)
|
|
271
|
+
break
|
|
272
|
+
case 2:
|
|
273
|
+
obj.error = ErrorResponse.codec().decode(reader, reader.uint32())
|
|
274
|
+
break
|
|
275
|
+
case 3:
|
|
276
|
+
obj.streamInfo = StreamInfo.codec().decode(reader, reader.uint32())
|
|
277
|
+
break
|
|
278
|
+
case 4:
|
|
279
|
+
obj.identify = IdentifyResponse.codec().decode(reader, reader.uint32())
|
|
280
|
+
break
|
|
281
|
+
case 5:
|
|
282
|
+
obj.dht = DHTResponse.codec().decode(reader, reader.uint32())
|
|
283
|
+
break
|
|
284
|
+
case 6:
|
|
285
|
+
obj.peers = obj.peers ?? []
|
|
286
|
+
obj.peers.push(PeerInfo.codec().decode(reader, reader.uint32()))
|
|
287
|
+
break
|
|
288
|
+
case 7:
|
|
289
|
+
obj.pubsub = PSResponse.codec().decode(reader, reader.uint32())
|
|
290
|
+
break
|
|
291
|
+
case 8:
|
|
292
|
+
obj.peerStore = PeerstoreResponse.codec().decode(reader, reader.uint32())
|
|
293
|
+
break
|
|
294
|
+
default:
|
|
295
|
+
reader.skipType(tag & 7)
|
|
296
|
+
break
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
obj.peers = obj.peers ?? []
|
|
301
|
+
|
|
302
|
+
if (obj.type == null) {
|
|
303
|
+
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (obj.peers == null) {
|
|
307
|
+
throw new Error('Protocol error: value for required field "peers" was not found in protobuf')
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return obj
|
|
311
|
+
})
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return _codec
|
|
114
315
|
}
|
|
115
316
|
|
|
116
317
|
export const encode = (obj: Response): Uint8Array => {
|
|
117
318
|
return encodeMessage(obj, Response.codec())
|
|
118
319
|
}
|
|
119
320
|
|
|
120
|
-
export const decode = (buf: Uint8Array): Response => {
|
|
321
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): Response => {
|
|
121
322
|
return decodeMessage(buf, Response.codec())
|
|
122
323
|
}
|
|
123
324
|
}
|
|
@@ -128,18 +329,78 @@ export interface IdentifyResponse {
|
|
|
128
329
|
}
|
|
129
330
|
|
|
130
331
|
export namespace IdentifyResponse {
|
|
332
|
+
let _codec: Codec<IdentifyResponse>
|
|
333
|
+
|
|
131
334
|
export const codec = (): Codec<IdentifyResponse> => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
335
|
+
if (_codec == null) {
|
|
336
|
+
_codec = message<IdentifyResponse>((obj, writer, opts = {}) => {
|
|
337
|
+
if (opts.lengthDelimited !== false) {
|
|
338
|
+
writer.fork()
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (obj.id != null) {
|
|
342
|
+
writer.uint32(10)
|
|
343
|
+
writer.bytes(obj.id)
|
|
344
|
+
} else {
|
|
345
|
+
throw new Error('Protocol error: required field "id" was not found in object')
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (obj.addrs != null) {
|
|
349
|
+
for (const value of obj.addrs) {
|
|
350
|
+
writer.uint32(18)
|
|
351
|
+
writer.bytes(value)
|
|
352
|
+
}
|
|
353
|
+
} else {
|
|
354
|
+
throw new Error('Protocol error: required field "addrs" was not found in object')
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (opts.lengthDelimited !== false) {
|
|
358
|
+
writer.ldelim()
|
|
359
|
+
}
|
|
360
|
+
}, (reader, length) => {
|
|
361
|
+
const obj: any = {}
|
|
362
|
+
|
|
363
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
364
|
+
|
|
365
|
+
while (reader.pos < end) {
|
|
366
|
+
const tag = reader.uint32()
|
|
367
|
+
|
|
368
|
+
switch (tag >>> 3) {
|
|
369
|
+
case 1:
|
|
370
|
+
obj.id = reader.bytes()
|
|
371
|
+
break
|
|
372
|
+
case 2:
|
|
373
|
+
obj.addrs = obj.addrs ?? []
|
|
374
|
+
obj.addrs.push(reader.bytes())
|
|
375
|
+
break
|
|
376
|
+
default:
|
|
377
|
+
reader.skipType(tag & 7)
|
|
378
|
+
break
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
obj.addrs = obj.addrs ?? []
|
|
383
|
+
|
|
384
|
+
if (obj.id == null) {
|
|
385
|
+
throw new Error('Protocol error: value for required field "id" was not found in protobuf')
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (obj.addrs == null) {
|
|
389
|
+
throw new Error('Protocol error: value for required field "addrs" was not found in protobuf')
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return obj
|
|
393
|
+
})
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return _codec
|
|
136
397
|
}
|
|
137
398
|
|
|
138
399
|
export const encode = (obj: IdentifyResponse): Uint8Array => {
|
|
139
400
|
return encodeMessage(obj, IdentifyResponse.codec())
|
|
140
401
|
}
|
|
141
402
|
|
|
142
|
-
export const decode = (buf: Uint8Array): IdentifyResponse => {
|
|
403
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): IdentifyResponse => {
|
|
143
404
|
return decodeMessage(buf, IdentifyResponse.codec())
|
|
144
405
|
}
|
|
145
406
|
}
|
|
@@ -151,19 +412,86 @@ export interface ConnectRequest {
|
|
|
151
412
|
}
|
|
152
413
|
|
|
153
414
|
export namespace ConnectRequest {
|
|
415
|
+
let _codec: Codec<ConnectRequest>
|
|
416
|
+
|
|
154
417
|
export const codec = (): Codec<ConnectRequest> => {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
418
|
+
if (_codec == null) {
|
|
419
|
+
_codec = message<ConnectRequest>((obj, writer, opts = {}) => {
|
|
420
|
+
if (opts.lengthDelimited !== false) {
|
|
421
|
+
writer.fork()
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (obj.peer != null) {
|
|
425
|
+
writer.uint32(10)
|
|
426
|
+
writer.bytes(obj.peer)
|
|
427
|
+
} else {
|
|
428
|
+
throw new Error('Protocol error: required field "peer" was not found in object')
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
if (obj.addrs != null) {
|
|
432
|
+
for (const value of obj.addrs) {
|
|
433
|
+
writer.uint32(18)
|
|
434
|
+
writer.bytes(value)
|
|
435
|
+
}
|
|
436
|
+
} else {
|
|
437
|
+
throw new Error('Protocol error: required field "addrs" was not found in object')
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (obj.timeout != null) {
|
|
441
|
+
writer.uint32(24)
|
|
442
|
+
writer.int64(obj.timeout)
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (opts.lengthDelimited !== false) {
|
|
446
|
+
writer.ldelim()
|
|
447
|
+
}
|
|
448
|
+
}, (reader, length) => {
|
|
449
|
+
const obj: any = {}
|
|
450
|
+
|
|
451
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
452
|
+
|
|
453
|
+
while (reader.pos < end) {
|
|
454
|
+
const tag = reader.uint32()
|
|
455
|
+
|
|
456
|
+
switch (tag >>> 3) {
|
|
457
|
+
case 1:
|
|
458
|
+
obj.peer = reader.bytes()
|
|
459
|
+
break
|
|
460
|
+
case 2:
|
|
461
|
+
obj.addrs = obj.addrs ?? []
|
|
462
|
+
obj.addrs.push(reader.bytes())
|
|
463
|
+
break
|
|
464
|
+
case 3:
|
|
465
|
+
obj.timeout = reader.int64()
|
|
466
|
+
break
|
|
467
|
+
default:
|
|
468
|
+
reader.skipType(tag & 7)
|
|
469
|
+
break
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
obj.addrs = obj.addrs ?? []
|
|
474
|
+
|
|
475
|
+
if (obj.peer == null) {
|
|
476
|
+
throw new Error('Protocol error: value for required field "peer" was not found in protobuf')
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
if (obj.addrs == null) {
|
|
480
|
+
throw new Error('Protocol error: value for required field "addrs" was not found in protobuf')
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return obj
|
|
484
|
+
})
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
return _codec
|
|
160
488
|
}
|
|
161
489
|
|
|
162
490
|
export const encode = (obj: ConnectRequest): Uint8Array => {
|
|
163
491
|
return encodeMessage(obj, ConnectRequest.codec())
|
|
164
492
|
}
|
|
165
493
|
|
|
166
|
-
export const decode = (buf: Uint8Array): ConnectRequest => {
|
|
494
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): ConnectRequest => {
|
|
167
495
|
return decodeMessage(buf, ConnectRequest.codec())
|
|
168
496
|
}
|
|
169
497
|
}
|
|
@@ -175,19 +503,86 @@ export interface StreamOpenRequest {
|
|
|
175
503
|
}
|
|
176
504
|
|
|
177
505
|
export namespace StreamOpenRequest {
|
|
506
|
+
let _codec: Codec<StreamOpenRequest>
|
|
507
|
+
|
|
178
508
|
export const codec = (): Codec<StreamOpenRequest> => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
509
|
+
if (_codec == null) {
|
|
510
|
+
_codec = message<StreamOpenRequest>((obj, writer, opts = {}) => {
|
|
511
|
+
if (opts.lengthDelimited !== false) {
|
|
512
|
+
writer.fork()
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if (obj.peer != null) {
|
|
516
|
+
writer.uint32(10)
|
|
517
|
+
writer.bytes(obj.peer)
|
|
518
|
+
} else {
|
|
519
|
+
throw new Error('Protocol error: required field "peer" was not found in object')
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (obj.proto != null) {
|
|
523
|
+
for (const value of obj.proto) {
|
|
524
|
+
writer.uint32(18)
|
|
525
|
+
writer.string(value)
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
throw new Error('Protocol error: required field "proto" was not found in object')
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (obj.timeout != null) {
|
|
532
|
+
writer.uint32(24)
|
|
533
|
+
writer.int64(obj.timeout)
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
if (opts.lengthDelimited !== false) {
|
|
537
|
+
writer.ldelim()
|
|
538
|
+
}
|
|
539
|
+
}, (reader, length) => {
|
|
540
|
+
const obj: any = {}
|
|
541
|
+
|
|
542
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
543
|
+
|
|
544
|
+
while (reader.pos < end) {
|
|
545
|
+
const tag = reader.uint32()
|
|
546
|
+
|
|
547
|
+
switch (tag >>> 3) {
|
|
548
|
+
case 1:
|
|
549
|
+
obj.peer = reader.bytes()
|
|
550
|
+
break
|
|
551
|
+
case 2:
|
|
552
|
+
obj.proto = obj.proto ?? []
|
|
553
|
+
obj.proto.push(reader.string())
|
|
554
|
+
break
|
|
555
|
+
case 3:
|
|
556
|
+
obj.timeout = reader.int64()
|
|
557
|
+
break
|
|
558
|
+
default:
|
|
559
|
+
reader.skipType(tag & 7)
|
|
560
|
+
break
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
obj.proto = obj.proto ?? []
|
|
565
|
+
|
|
566
|
+
if (obj.peer == null) {
|
|
567
|
+
throw new Error('Protocol error: value for required field "peer" was not found in protobuf')
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if (obj.proto == null) {
|
|
571
|
+
throw new Error('Protocol error: value for required field "proto" was not found in protobuf')
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
return obj
|
|
575
|
+
})
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
return _codec
|
|
184
579
|
}
|
|
185
580
|
|
|
186
581
|
export const encode = (obj: StreamOpenRequest): Uint8Array => {
|
|
187
582
|
return encodeMessage(obj, StreamOpenRequest.codec())
|
|
188
583
|
}
|
|
189
584
|
|
|
190
|
-
export const decode = (buf: Uint8Array): StreamOpenRequest => {
|
|
585
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): StreamOpenRequest => {
|
|
191
586
|
return decodeMessage(buf, StreamOpenRequest.codec())
|
|
192
587
|
}
|
|
193
588
|
}
|
|
@@ -198,18 +593,78 @@ export interface StreamHandlerRequest {
|
|
|
198
593
|
}
|
|
199
594
|
|
|
200
595
|
export namespace StreamHandlerRequest {
|
|
596
|
+
let _codec: Codec<StreamHandlerRequest>
|
|
597
|
+
|
|
201
598
|
export const codec = (): Codec<StreamHandlerRequest> => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
599
|
+
if (_codec == null) {
|
|
600
|
+
_codec = message<StreamHandlerRequest>((obj, writer, opts = {}) => {
|
|
601
|
+
if (opts.lengthDelimited !== false) {
|
|
602
|
+
writer.fork()
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if (obj.addr != null) {
|
|
606
|
+
writer.uint32(10)
|
|
607
|
+
writer.bytes(obj.addr)
|
|
608
|
+
} else {
|
|
609
|
+
throw new Error('Protocol error: required field "addr" was not found in object')
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
if (obj.proto != null) {
|
|
613
|
+
for (const value of obj.proto) {
|
|
614
|
+
writer.uint32(18)
|
|
615
|
+
writer.string(value)
|
|
616
|
+
}
|
|
617
|
+
} else {
|
|
618
|
+
throw new Error('Protocol error: required field "proto" was not found in object')
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if (opts.lengthDelimited !== false) {
|
|
622
|
+
writer.ldelim()
|
|
623
|
+
}
|
|
624
|
+
}, (reader, length) => {
|
|
625
|
+
const obj: any = {}
|
|
626
|
+
|
|
627
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
628
|
+
|
|
629
|
+
while (reader.pos < end) {
|
|
630
|
+
const tag = reader.uint32()
|
|
631
|
+
|
|
632
|
+
switch (tag >>> 3) {
|
|
633
|
+
case 1:
|
|
634
|
+
obj.addr = reader.bytes()
|
|
635
|
+
break
|
|
636
|
+
case 2:
|
|
637
|
+
obj.proto = obj.proto ?? []
|
|
638
|
+
obj.proto.push(reader.string())
|
|
639
|
+
break
|
|
640
|
+
default:
|
|
641
|
+
reader.skipType(tag & 7)
|
|
642
|
+
break
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
obj.proto = obj.proto ?? []
|
|
647
|
+
|
|
648
|
+
if (obj.addr == null) {
|
|
649
|
+
throw new Error('Protocol error: value for required field "addr" was not found in protobuf')
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if (obj.proto == null) {
|
|
653
|
+
throw new Error('Protocol error: value for required field "proto" was not found in protobuf')
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
return obj
|
|
657
|
+
})
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
return _codec
|
|
206
661
|
}
|
|
207
662
|
|
|
208
663
|
export const encode = (obj: StreamHandlerRequest): Uint8Array => {
|
|
209
664
|
return encodeMessage(obj, StreamHandlerRequest.codec())
|
|
210
665
|
}
|
|
211
666
|
|
|
212
|
-
export const decode = (buf: Uint8Array): StreamHandlerRequest => {
|
|
667
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): StreamHandlerRequest => {
|
|
213
668
|
return decodeMessage(buf, StreamHandlerRequest.codec())
|
|
214
669
|
}
|
|
215
670
|
}
|
|
@@ -219,17 +674,59 @@ export interface ErrorResponse {
|
|
|
219
674
|
}
|
|
220
675
|
|
|
221
676
|
export namespace ErrorResponse {
|
|
677
|
+
let _codec: Codec<ErrorResponse>
|
|
678
|
+
|
|
222
679
|
export const codec = (): Codec<ErrorResponse> => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
680
|
+
if (_codec == null) {
|
|
681
|
+
_codec = message<ErrorResponse>((obj, writer, opts = {}) => {
|
|
682
|
+
if (opts.lengthDelimited !== false) {
|
|
683
|
+
writer.fork()
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
if (obj.msg != null) {
|
|
687
|
+
writer.uint32(10)
|
|
688
|
+
writer.string(obj.msg)
|
|
689
|
+
} else {
|
|
690
|
+
throw new Error('Protocol error: required field "msg" was not found in object')
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
if (opts.lengthDelimited !== false) {
|
|
694
|
+
writer.ldelim()
|
|
695
|
+
}
|
|
696
|
+
}, (reader, length) => {
|
|
697
|
+
const obj: any = {}
|
|
698
|
+
|
|
699
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
700
|
+
|
|
701
|
+
while (reader.pos < end) {
|
|
702
|
+
const tag = reader.uint32()
|
|
703
|
+
|
|
704
|
+
switch (tag >>> 3) {
|
|
705
|
+
case 1:
|
|
706
|
+
obj.msg = reader.string()
|
|
707
|
+
break
|
|
708
|
+
default:
|
|
709
|
+
reader.skipType(tag & 7)
|
|
710
|
+
break
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
if (obj.msg == null) {
|
|
715
|
+
throw new Error('Protocol error: value for required field "msg" was not found in protobuf')
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
return obj
|
|
719
|
+
})
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
return _codec
|
|
226
723
|
}
|
|
227
724
|
|
|
228
725
|
export const encode = (obj: ErrorResponse): Uint8Array => {
|
|
229
726
|
return encodeMessage(obj, ErrorResponse.codec())
|
|
230
727
|
}
|
|
231
728
|
|
|
232
|
-
export const decode = (buf: Uint8Array): ErrorResponse => {
|
|
729
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): ErrorResponse => {
|
|
233
730
|
return decodeMessage(buf, ErrorResponse.codec())
|
|
234
731
|
}
|
|
235
732
|
}
|
|
@@ -241,19 +738,87 @@ export interface StreamInfo {
|
|
|
241
738
|
}
|
|
242
739
|
|
|
243
740
|
export namespace StreamInfo {
|
|
741
|
+
let _codec: Codec<StreamInfo>
|
|
742
|
+
|
|
244
743
|
export const codec = (): Codec<StreamInfo> => {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
744
|
+
if (_codec == null) {
|
|
745
|
+
_codec = message<StreamInfo>((obj, writer, opts = {}) => {
|
|
746
|
+
if (opts.lengthDelimited !== false) {
|
|
747
|
+
writer.fork()
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if (obj.peer != null) {
|
|
751
|
+
writer.uint32(10)
|
|
752
|
+
writer.bytes(obj.peer)
|
|
753
|
+
} else {
|
|
754
|
+
throw new Error('Protocol error: required field "peer" was not found in object')
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
if (obj.addr != null) {
|
|
758
|
+
writer.uint32(18)
|
|
759
|
+
writer.bytes(obj.addr)
|
|
760
|
+
} else {
|
|
761
|
+
throw new Error('Protocol error: required field "addr" was not found in object')
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
if (obj.proto != null) {
|
|
765
|
+
writer.uint32(26)
|
|
766
|
+
writer.string(obj.proto)
|
|
767
|
+
} else {
|
|
768
|
+
throw new Error('Protocol error: required field "proto" was not found in object')
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
if (opts.lengthDelimited !== false) {
|
|
772
|
+
writer.ldelim()
|
|
773
|
+
}
|
|
774
|
+
}, (reader, length) => {
|
|
775
|
+
const obj: any = {}
|
|
776
|
+
|
|
777
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
778
|
+
|
|
779
|
+
while (reader.pos < end) {
|
|
780
|
+
const tag = reader.uint32()
|
|
781
|
+
|
|
782
|
+
switch (tag >>> 3) {
|
|
783
|
+
case 1:
|
|
784
|
+
obj.peer = reader.bytes()
|
|
785
|
+
break
|
|
786
|
+
case 2:
|
|
787
|
+
obj.addr = reader.bytes()
|
|
788
|
+
break
|
|
789
|
+
case 3:
|
|
790
|
+
obj.proto = reader.string()
|
|
791
|
+
break
|
|
792
|
+
default:
|
|
793
|
+
reader.skipType(tag & 7)
|
|
794
|
+
break
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
if (obj.peer == null) {
|
|
799
|
+
throw new Error('Protocol error: value for required field "peer" was not found in protobuf')
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
if (obj.addr == null) {
|
|
803
|
+
throw new Error('Protocol error: value for required field "addr" was not found in protobuf')
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
if (obj.proto == null) {
|
|
807
|
+
throw new Error('Protocol error: value for required field "proto" was not found in protobuf')
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
return obj
|
|
811
|
+
})
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
return _codec
|
|
250
815
|
}
|
|
251
816
|
|
|
252
817
|
export const encode = (obj: StreamInfo): Uint8Array => {
|
|
253
818
|
return encodeMessage(obj, StreamInfo.codec())
|
|
254
819
|
}
|
|
255
820
|
|
|
256
|
-
export const decode = (buf: Uint8Array): StreamInfo => {
|
|
821
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): StreamInfo => {
|
|
257
822
|
return decodeMessage(buf, StreamInfo.codec())
|
|
258
823
|
}
|
|
259
824
|
}
|
|
@@ -295,27 +860,111 @@ export namespace DHTRequest {
|
|
|
295
860
|
|
|
296
861
|
export namespace Type {
|
|
297
862
|
export const codec = () => {
|
|
298
|
-
return enumeration<
|
|
863
|
+
return enumeration<Type>(__TypeValues)
|
|
299
864
|
}
|
|
300
865
|
}
|
|
301
866
|
|
|
867
|
+
let _codec: Codec<DHTRequest>
|
|
868
|
+
|
|
302
869
|
export const codec = (): Codec<DHTRequest> => {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
870
|
+
if (_codec == null) {
|
|
871
|
+
_codec = message<DHTRequest>((obj, writer, opts = {}) => {
|
|
872
|
+
if (opts.lengthDelimited !== false) {
|
|
873
|
+
writer.fork()
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
if (obj.type != null) {
|
|
877
|
+
writer.uint32(8)
|
|
878
|
+
DHTRequest.Type.codec().encode(obj.type, writer)
|
|
879
|
+
} else {
|
|
880
|
+
throw new Error('Protocol error: required field "type" was not found in object')
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
if (obj.peer != null) {
|
|
884
|
+
writer.uint32(18)
|
|
885
|
+
writer.bytes(obj.peer)
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
if (obj.cid != null) {
|
|
889
|
+
writer.uint32(26)
|
|
890
|
+
writer.bytes(obj.cid)
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
if (obj.key != null) {
|
|
894
|
+
writer.uint32(34)
|
|
895
|
+
writer.bytes(obj.key)
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
if (obj.value != null) {
|
|
899
|
+
writer.uint32(42)
|
|
900
|
+
writer.bytes(obj.value)
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
if (obj.count != null) {
|
|
904
|
+
writer.uint32(48)
|
|
905
|
+
writer.int32(obj.count)
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
if (obj.timeout != null) {
|
|
909
|
+
writer.uint32(56)
|
|
910
|
+
writer.int64(obj.timeout)
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
if (opts.lengthDelimited !== false) {
|
|
914
|
+
writer.ldelim()
|
|
915
|
+
}
|
|
916
|
+
}, (reader, length) => {
|
|
917
|
+
const obj: any = {}
|
|
918
|
+
|
|
919
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
920
|
+
|
|
921
|
+
while (reader.pos < end) {
|
|
922
|
+
const tag = reader.uint32()
|
|
923
|
+
|
|
924
|
+
switch (tag >>> 3) {
|
|
925
|
+
case 1:
|
|
926
|
+
obj.type = DHTRequest.Type.codec().decode(reader)
|
|
927
|
+
break
|
|
928
|
+
case 2:
|
|
929
|
+
obj.peer = reader.bytes()
|
|
930
|
+
break
|
|
931
|
+
case 3:
|
|
932
|
+
obj.cid = reader.bytes()
|
|
933
|
+
break
|
|
934
|
+
case 4:
|
|
935
|
+
obj.key = reader.bytes()
|
|
936
|
+
break
|
|
937
|
+
case 5:
|
|
938
|
+
obj.value = reader.bytes()
|
|
939
|
+
break
|
|
940
|
+
case 6:
|
|
941
|
+
obj.count = reader.int32()
|
|
942
|
+
break
|
|
943
|
+
case 7:
|
|
944
|
+
obj.timeout = reader.int64()
|
|
945
|
+
break
|
|
946
|
+
default:
|
|
947
|
+
reader.skipType(tag & 7)
|
|
948
|
+
break
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
if (obj.type == null) {
|
|
953
|
+
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
return obj
|
|
957
|
+
})
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
return _codec
|
|
312
961
|
}
|
|
313
962
|
|
|
314
963
|
export const encode = (obj: DHTRequest): Uint8Array => {
|
|
315
964
|
return encodeMessage(obj, DHTRequest.codec())
|
|
316
965
|
}
|
|
317
966
|
|
|
318
|
-
export const decode = (buf: Uint8Array): DHTRequest => {
|
|
967
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): DHTRequest => {
|
|
319
968
|
return decodeMessage(buf, DHTRequest.codec())
|
|
320
969
|
}
|
|
321
970
|
}
|
|
@@ -341,23 +990,79 @@ export namespace DHTResponse {
|
|
|
341
990
|
|
|
342
991
|
export namespace Type {
|
|
343
992
|
export const codec = () => {
|
|
344
|
-
return enumeration<
|
|
993
|
+
return enumeration<Type>(__TypeValues)
|
|
345
994
|
}
|
|
346
995
|
}
|
|
347
996
|
|
|
997
|
+
let _codec: Codec<DHTResponse>
|
|
998
|
+
|
|
348
999
|
export const codec = (): Codec<DHTResponse> => {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
1000
|
+
if (_codec == null) {
|
|
1001
|
+
_codec = message<DHTResponse>((obj, writer, opts = {}) => {
|
|
1002
|
+
if (opts.lengthDelimited !== false) {
|
|
1003
|
+
writer.fork()
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
if (obj.type != null) {
|
|
1007
|
+
writer.uint32(8)
|
|
1008
|
+
DHTResponse.Type.codec().encode(obj.type, writer)
|
|
1009
|
+
} else {
|
|
1010
|
+
throw new Error('Protocol error: required field "type" was not found in object')
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
if (obj.peer != null) {
|
|
1014
|
+
writer.uint32(18)
|
|
1015
|
+
PeerInfo.codec().encode(obj.peer, writer)
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
if (obj.value != null) {
|
|
1019
|
+
writer.uint32(26)
|
|
1020
|
+
writer.bytes(obj.value)
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
if (opts.lengthDelimited !== false) {
|
|
1024
|
+
writer.ldelim()
|
|
1025
|
+
}
|
|
1026
|
+
}, (reader, length) => {
|
|
1027
|
+
const obj: any = {}
|
|
1028
|
+
|
|
1029
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1030
|
+
|
|
1031
|
+
while (reader.pos < end) {
|
|
1032
|
+
const tag = reader.uint32()
|
|
1033
|
+
|
|
1034
|
+
switch (tag >>> 3) {
|
|
1035
|
+
case 1:
|
|
1036
|
+
obj.type = DHTResponse.Type.codec().decode(reader)
|
|
1037
|
+
break
|
|
1038
|
+
case 2:
|
|
1039
|
+
obj.peer = PeerInfo.codec().decode(reader, reader.uint32())
|
|
1040
|
+
break
|
|
1041
|
+
case 3:
|
|
1042
|
+
obj.value = reader.bytes()
|
|
1043
|
+
break
|
|
1044
|
+
default:
|
|
1045
|
+
reader.skipType(tag & 7)
|
|
1046
|
+
break
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
if (obj.type == null) {
|
|
1051
|
+
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
return obj
|
|
1055
|
+
})
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
return _codec
|
|
354
1059
|
}
|
|
355
1060
|
|
|
356
1061
|
export const encode = (obj: DHTResponse): Uint8Array => {
|
|
357
1062
|
return encodeMessage(obj, DHTResponse.codec())
|
|
358
1063
|
}
|
|
359
1064
|
|
|
360
|
-
export const decode = (buf: Uint8Array): DHTResponse => {
|
|
1065
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): DHTResponse => {
|
|
361
1066
|
return decodeMessage(buf, DHTResponse.codec())
|
|
362
1067
|
}
|
|
363
1068
|
}
|
|
@@ -368,18 +1073,78 @@ export interface PeerInfo {
|
|
|
368
1073
|
}
|
|
369
1074
|
|
|
370
1075
|
export namespace PeerInfo {
|
|
1076
|
+
let _codec: Codec<PeerInfo>
|
|
1077
|
+
|
|
371
1078
|
export const codec = (): Codec<PeerInfo> => {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
1079
|
+
if (_codec == null) {
|
|
1080
|
+
_codec = message<PeerInfo>((obj, writer, opts = {}) => {
|
|
1081
|
+
if (opts.lengthDelimited !== false) {
|
|
1082
|
+
writer.fork()
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
if (obj.id != null) {
|
|
1086
|
+
writer.uint32(10)
|
|
1087
|
+
writer.bytes(obj.id)
|
|
1088
|
+
} else {
|
|
1089
|
+
throw new Error('Protocol error: required field "id" was not found in object')
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
if (obj.addrs != null) {
|
|
1093
|
+
for (const value of obj.addrs) {
|
|
1094
|
+
writer.uint32(18)
|
|
1095
|
+
writer.bytes(value)
|
|
1096
|
+
}
|
|
1097
|
+
} else {
|
|
1098
|
+
throw new Error('Protocol error: required field "addrs" was not found in object')
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
if (opts.lengthDelimited !== false) {
|
|
1102
|
+
writer.ldelim()
|
|
1103
|
+
}
|
|
1104
|
+
}, (reader, length) => {
|
|
1105
|
+
const obj: any = {}
|
|
1106
|
+
|
|
1107
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1108
|
+
|
|
1109
|
+
while (reader.pos < end) {
|
|
1110
|
+
const tag = reader.uint32()
|
|
1111
|
+
|
|
1112
|
+
switch (tag >>> 3) {
|
|
1113
|
+
case 1:
|
|
1114
|
+
obj.id = reader.bytes()
|
|
1115
|
+
break
|
|
1116
|
+
case 2:
|
|
1117
|
+
obj.addrs = obj.addrs ?? []
|
|
1118
|
+
obj.addrs.push(reader.bytes())
|
|
1119
|
+
break
|
|
1120
|
+
default:
|
|
1121
|
+
reader.skipType(tag & 7)
|
|
1122
|
+
break
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
obj.addrs = obj.addrs ?? []
|
|
1127
|
+
|
|
1128
|
+
if (obj.id == null) {
|
|
1129
|
+
throw new Error('Protocol error: value for required field "id" was not found in protobuf')
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
if (obj.addrs == null) {
|
|
1133
|
+
throw new Error('Protocol error: value for required field "addrs" was not found in protobuf')
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
return obj
|
|
1137
|
+
})
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
return _codec
|
|
376
1141
|
}
|
|
377
1142
|
|
|
378
1143
|
export const encode = (obj: PeerInfo): Uint8Array => {
|
|
379
1144
|
return encodeMessage(obj, PeerInfo.codec())
|
|
380
1145
|
}
|
|
381
1146
|
|
|
382
|
-
export const decode = (buf: Uint8Array): PeerInfo => {
|
|
1147
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): PeerInfo => {
|
|
383
1148
|
return decodeMessage(buf, PeerInfo.codec())
|
|
384
1149
|
}
|
|
385
1150
|
}
|
|
@@ -406,24 +1171,87 @@ export namespace ConnManagerRequest {
|
|
|
406
1171
|
|
|
407
1172
|
export namespace Type {
|
|
408
1173
|
export const codec = () => {
|
|
409
|
-
return enumeration<
|
|
1174
|
+
return enumeration<Type>(__TypeValues)
|
|
410
1175
|
}
|
|
411
1176
|
}
|
|
412
1177
|
|
|
1178
|
+
let _codec: Codec<ConnManagerRequest>
|
|
1179
|
+
|
|
413
1180
|
export const codec = (): Codec<ConnManagerRequest> => {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
1181
|
+
if (_codec == null) {
|
|
1182
|
+
_codec = message<ConnManagerRequest>((obj, writer, opts = {}) => {
|
|
1183
|
+
if (opts.lengthDelimited !== false) {
|
|
1184
|
+
writer.fork()
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
if (obj.type != null) {
|
|
1188
|
+
writer.uint32(8)
|
|
1189
|
+
ConnManagerRequest.Type.codec().encode(obj.type, writer)
|
|
1190
|
+
} else {
|
|
1191
|
+
throw new Error('Protocol error: required field "type" was not found in object')
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
if (obj.peer != null) {
|
|
1195
|
+
writer.uint32(18)
|
|
1196
|
+
writer.bytes(obj.peer)
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
if (obj.tag != null) {
|
|
1200
|
+
writer.uint32(26)
|
|
1201
|
+
writer.string(obj.tag)
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
if (obj.weight != null) {
|
|
1205
|
+
writer.uint32(32)
|
|
1206
|
+
writer.int64(obj.weight)
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
if (opts.lengthDelimited !== false) {
|
|
1210
|
+
writer.ldelim()
|
|
1211
|
+
}
|
|
1212
|
+
}, (reader, length) => {
|
|
1213
|
+
const obj: any = {}
|
|
1214
|
+
|
|
1215
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1216
|
+
|
|
1217
|
+
while (reader.pos < end) {
|
|
1218
|
+
const tag = reader.uint32()
|
|
1219
|
+
|
|
1220
|
+
switch (tag >>> 3) {
|
|
1221
|
+
case 1:
|
|
1222
|
+
obj.type = ConnManagerRequest.Type.codec().decode(reader)
|
|
1223
|
+
break
|
|
1224
|
+
case 2:
|
|
1225
|
+
obj.peer = reader.bytes()
|
|
1226
|
+
break
|
|
1227
|
+
case 3:
|
|
1228
|
+
obj.tag = reader.string()
|
|
1229
|
+
break
|
|
1230
|
+
case 4:
|
|
1231
|
+
obj.weight = reader.int64()
|
|
1232
|
+
break
|
|
1233
|
+
default:
|
|
1234
|
+
reader.skipType(tag & 7)
|
|
1235
|
+
break
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
if (obj.type == null) {
|
|
1240
|
+
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
return obj
|
|
1244
|
+
})
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
return _codec
|
|
420
1248
|
}
|
|
421
1249
|
|
|
422
1250
|
export const encode = (obj: ConnManagerRequest): Uint8Array => {
|
|
423
1251
|
return encodeMessage(obj, ConnManagerRequest.codec())
|
|
424
1252
|
}
|
|
425
1253
|
|
|
426
|
-
export const decode = (buf: Uint8Array): ConnManagerRequest => {
|
|
1254
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): ConnManagerRequest => {
|
|
427
1255
|
return decodeMessage(buf, ConnManagerRequest.codec())
|
|
428
1256
|
}
|
|
429
1257
|
}
|
|
@@ -433,17 +1261,59 @@ export interface DisconnectRequest {
|
|
|
433
1261
|
}
|
|
434
1262
|
|
|
435
1263
|
export namespace DisconnectRequest {
|
|
1264
|
+
let _codec: Codec<DisconnectRequest>
|
|
1265
|
+
|
|
436
1266
|
export const codec = (): Codec<DisconnectRequest> => {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
1267
|
+
if (_codec == null) {
|
|
1268
|
+
_codec = message<DisconnectRequest>((obj, writer, opts = {}) => {
|
|
1269
|
+
if (opts.lengthDelimited !== false) {
|
|
1270
|
+
writer.fork()
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
if (obj.peer != null) {
|
|
1274
|
+
writer.uint32(10)
|
|
1275
|
+
writer.bytes(obj.peer)
|
|
1276
|
+
} else {
|
|
1277
|
+
throw new Error('Protocol error: required field "peer" was not found in object')
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
if (opts.lengthDelimited !== false) {
|
|
1281
|
+
writer.ldelim()
|
|
1282
|
+
}
|
|
1283
|
+
}, (reader, length) => {
|
|
1284
|
+
const obj: any = {}
|
|
1285
|
+
|
|
1286
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1287
|
+
|
|
1288
|
+
while (reader.pos < end) {
|
|
1289
|
+
const tag = reader.uint32()
|
|
1290
|
+
|
|
1291
|
+
switch (tag >>> 3) {
|
|
1292
|
+
case 1:
|
|
1293
|
+
obj.peer = reader.bytes()
|
|
1294
|
+
break
|
|
1295
|
+
default:
|
|
1296
|
+
reader.skipType(tag & 7)
|
|
1297
|
+
break
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
if (obj.peer == null) {
|
|
1302
|
+
throw new Error('Protocol error: value for required field "peer" was not found in protobuf')
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
return obj
|
|
1306
|
+
})
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
return _codec
|
|
440
1310
|
}
|
|
441
1311
|
|
|
442
1312
|
export const encode = (obj: DisconnectRequest): Uint8Array => {
|
|
443
1313
|
return encodeMessage(obj, DisconnectRequest.codec())
|
|
444
1314
|
}
|
|
445
1315
|
|
|
446
|
-
export const decode = (buf: Uint8Array): DisconnectRequest => {
|
|
1316
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): DisconnectRequest => {
|
|
447
1317
|
return decodeMessage(buf, DisconnectRequest.codec())
|
|
448
1318
|
}
|
|
449
1319
|
}
|
|
@@ -471,23 +1341,79 @@ export namespace PSRequest {
|
|
|
471
1341
|
|
|
472
1342
|
export namespace Type {
|
|
473
1343
|
export const codec = () => {
|
|
474
|
-
return enumeration<
|
|
1344
|
+
return enumeration<Type>(__TypeValues)
|
|
475
1345
|
}
|
|
476
1346
|
}
|
|
477
1347
|
|
|
1348
|
+
let _codec: Codec<PSRequest>
|
|
1349
|
+
|
|
478
1350
|
export const codec = (): Codec<PSRequest> => {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
1351
|
+
if (_codec == null) {
|
|
1352
|
+
_codec = message<PSRequest>((obj, writer, opts = {}) => {
|
|
1353
|
+
if (opts.lengthDelimited !== false) {
|
|
1354
|
+
writer.fork()
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
if (obj.type != null) {
|
|
1358
|
+
writer.uint32(8)
|
|
1359
|
+
PSRequest.Type.codec().encode(obj.type, writer)
|
|
1360
|
+
} else {
|
|
1361
|
+
throw new Error('Protocol error: required field "type" was not found in object')
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
if (obj.topic != null) {
|
|
1365
|
+
writer.uint32(18)
|
|
1366
|
+
writer.string(obj.topic)
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
if (obj.data != null) {
|
|
1370
|
+
writer.uint32(26)
|
|
1371
|
+
writer.bytes(obj.data)
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
if (opts.lengthDelimited !== false) {
|
|
1375
|
+
writer.ldelim()
|
|
1376
|
+
}
|
|
1377
|
+
}, (reader, length) => {
|
|
1378
|
+
const obj: any = {}
|
|
1379
|
+
|
|
1380
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1381
|
+
|
|
1382
|
+
while (reader.pos < end) {
|
|
1383
|
+
const tag = reader.uint32()
|
|
1384
|
+
|
|
1385
|
+
switch (tag >>> 3) {
|
|
1386
|
+
case 1:
|
|
1387
|
+
obj.type = PSRequest.Type.codec().decode(reader)
|
|
1388
|
+
break
|
|
1389
|
+
case 2:
|
|
1390
|
+
obj.topic = reader.string()
|
|
1391
|
+
break
|
|
1392
|
+
case 3:
|
|
1393
|
+
obj.data = reader.bytes()
|
|
1394
|
+
break
|
|
1395
|
+
default:
|
|
1396
|
+
reader.skipType(tag & 7)
|
|
1397
|
+
break
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
if (obj.type == null) {
|
|
1402
|
+
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
return obj
|
|
1406
|
+
})
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
return _codec
|
|
484
1410
|
}
|
|
485
1411
|
|
|
486
1412
|
export const encode = (obj: PSRequest): Uint8Array => {
|
|
487
1413
|
return encodeMessage(obj, PSRequest.codec())
|
|
488
1414
|
}
|
|
489
1415
|
|
|
490
|
-
export const decode = (buf: Uint8Array): PSRequest => {
|
|
1416
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): PSRequest => {
|
|
491
1417
|
return decodeMessage(buf, PSRequest.codec())
|
|
492
1418
|
}
|
|
493
1419
|
}
|
|
@@ -502,22 +1428,104 @@ export interface PSMessage {
|
|
|
502
1428
|
}
|
|
503
1429
|
|
|
504
1430
|
export namespace PSMessage {
|
|
1431
|
+
let _codec: Codec<PSMessage>
|
|
1432
|
+
|
|
505
1433
|
export const codec = (): Codec<PSMessage> => {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
1434
|
+
if (_codec == null) {
|
|
1435
|
+
_codec = message<PSMessage>((obj, writer, opts = {}) => {
|
|
1436
|
+
if (opts.lengthDelimited !== false) {
|
|
1437
|
+
writer.fork()
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
if (obj.from != null) {
|
|
1441
|
+
writer.uint32(10)
|
|
1442
|
+
writer.bytes(obj.from)
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
if (obj.data != null) {
|
|
1446
|
+
writer.uint32(18)
|
|
1447
|
+
writer.bytes(obj.data)
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
if (obj.seqno != null) {
|
|
1451
|
+
writer.uint32(26)
|
|
1452
|
+
writer.bytes(obj.seqno)
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
if (obj.topicIDs != null) {
|
|
1456
|
+
for (const value of obj.topicIDs) {
|
|
1457
|
+
writer.uint32(34)
|
|
1458
|
+
writer.string(value)
|
|
1459
|
+
}
|
|
1460
|
+
} else {
|
|
1461
|
+
throw new Error('Protocol error: required field "topicIDs" was not found in object')
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
if (obj.signature != null) {
|
|
1465
|
+
writer.uint32(42)
|
|
1466
|
+
writer.bytes(obj.signature)
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
if (obj.key != null) {
|
|
1470
|
+
writer.uint32(50)
|
|
1471
|
+
writer.bytes(obj.key)
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
if (opts.lengthDelimited !== false) {
|
|
1475
|
+
writer.ldelim()
|
|
1476
|
+
}
|
|
1477
|
+
}, (reader, length) => {
|
|
1478
|
+
const obj: any = {}
|
|
1479
|
+
|
|
1480
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1481
|
+
|
|
1482
|
+
while (reader.pos < end) {
|
|
1483
|
+
const tag = reader.uint32()
|
|
1484
|
+
|
|
1485
|
+
switch (tag >>> 3) {
|
|
1486
|
+
case 1:
|
|
1487
|
+
obj.from = reader.bytes()
|
|
1488
|
+
break
|
|
1489
|
+
case 2:
|
|
1490
|
+
obj.data = reader.bytes()
|
|
1491
|
+
break
|
|
1492
|
+
case 3:
|
|
1493
|
+
obj.seqno = reader.bytes()
|
|
1494
|
+
break
|
|
1495
|
+
case 4:
|
|
1496
|
+
obj.topicIDs = obj.topicIDs ?? []
|
|
1497
|
+
obj.topicIDs.push(reader.string())
|
|
1498
|
+
break
|
|
1499
|
+
case 5:
|
|
1500
|
+
obj.signature = reader.bytes()
|
|
1501
|
+
break
|
|
1502
|
+
case 6:
|
|
1503
|
+
obj.key = reader.bytes()
|
|
1504
|
+
break
|
|
1505
|
+
default:
|
|
1506
|
+
reader.skipType(tag & 7)
|
|
1507
|
+
break
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
obj.topicIDs = obj.topicIDs ?? []
|
|
1512
|
+
|
|
1513
|
+
if (obj.topicIDs == null) {
|
|
1514
|
+
throw new Error('Protocol error: value for required field "topicIDs" was not found in protobuf')
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
return obj
|
|
1518
|
+
})
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
return _codec
|
|
514
1522
|
}
|
|
515
1523
|
|
|
516
1524
|
export const encode = (obj: PSMessage): Uint8Array => {
|
|
517
1525
|
return encodeMessage(obj, PSMessage.codec())
|
|
518
1526
|
}
|
|
519
1527
|
|
|
520
|
-
export const decode = (buf: Uint8Array): PSMessage => {
|
|
1528
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): PSMessage => {
|
|
521
1529
|
return decodeMessage(buf, PSMessage.codec())
|
|
522
1530
|
}
|
|
523
1531
|
}
|
|
@@ -528,18 +1536,82 @@ export interface PSResponse {
|
|
|
528
1536
|
}
|
|
529
1537
|
|
|
530
1538
|
export namespace PSResponse {
|
|
1539
|
+
let _codec: Codec<PSResponse>
|
|
1540
|
+
|
|
531
1541
|
export const codec = (): Codec<PSResponse> => {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
1542
|
+
if (_codec == null) {
|
|
1543
|
+
_codec = message<PSResponse>((obj, writer, opts = {}) => {
|
|
1544
|
+
if (opts.lengthDelimited !== false) {
|
|
1545
|
+
writer.fork()
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
if (obj.topics != null) {
|
|
1549
|
+
for (const value of obj.topics) {
|
|
1550
|
+
writer.uint32(10)
|
|
1551
|
+
writer.string(value)
|
|
1552
|
+
}
|
|
1553
|
+
} else {
|
|
1554
|
+
throw new Error('Protocol error: required field "topics" was not found in object')
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
if (obj.peerIDs != null) {
|
|
1558
|
+
for (const value of obj.peerIDs) {
|
|
1559
|
+
writer.uint32(18)
|
|
1560
|
+
writer.bytes(value)
|
|
1561
|
+
}
|
|
1562
|
+
} else {
|
|
1563
|
+
throw new Error('Protocol error: required field "peerIDs" was not found in object')
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
if (opts.lengthDelimited !== false) {
|
|
1567
|
+
writer.ldelim()
|
|
1568
|
+
}
|
|
1569
|
+
}, (reader, length) => {
|
|
1570
|
+
const obj: any = {}
|
|
1571
|
+
|
|
1572
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1573
|
+
|
|
1574
|
+
while (reader.pos < end) {
|
|
1575
|
+
const tag = reader.uint32()
|
|
1576
|
+
|
|
1577
|
+
switch (tag >>> 3) {
|
|
1578
|
+
case 1:
|
|
1579
|
+
obj.topics = obj.topics ?? []
|
|
1580
|
+
obj.topics.push(reader.string())
|
|
1581
|
+
break
|
|
1582
|
+
case 2:
|
|
1583
|
+
obj.peerIDs = obj.peerIDs ?? []
|
|
1584
|
+
obj.peerIDs.push(reader.bytes())
|
|
1585
|
+
break
|
|
1586
|
+
default:
|
|
1587
|
+
reader.skipType(tag & 7)
|
|
1588
|
+
break
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
obj.topics = obj.topics ?? []
|
|
1593
|
+
obj.peerIDs = obj.peerIDs ?? []
|
|
1594
|
+
|
|
1595
|
+
if (obj.topics == null) {
|
|
1596
|
+
throw new Error('Protocol error: value for required field "topics" was not found in protobuf')
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
if (obj.peerIDs == null) {
|
|
1600
|
+
throw new Error('Protocol error: value for required field "peerIDs" was not found in protobuf')
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
return obj
|
|
1604
|
+
})
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
return _codec
|
|
536
1608
|
}
|
|
537
1609
|
|
|
538
1610
|
export const encode = (obj: PSResponse): Uint8Array => {
|
|
539
1611
|
return encodeMessage(obj, PSResponse.codec())
|
|
540
1612
|
}
|
|
541
1613
|
|
|
542
|
-
export const decode = (buf: Uint8Array): PSResponse => {
|
|
1614
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): PSResponse => {
|
|
543
1615
|
return decodeMessage(buf, PSResponse.codec())
|
|
544
1616
|
}
|
|
545
1617
|
}
|
|
@@ -563,23 +1635,90 @@ export namespace PeerstoreRequest {
|
|
|
563
1635
|
|
|
564
1636
|
export namespace Type {
|
|
565
1637
|
export const codec = () => {
|
|
566
|
-
return enumeration<
|
|
1638
|
+
return enumeration<Type>(__TypeValues)
|
|
567
1639
|
}
|
|
568
1640
|
}
|
|
569
1641
|
|
|
1642
|
+
let _codec: Codec<PeerstoreRequest>
|
|
1643
|
+
|
|
570
1644
|
export const codec = (): Codec<PeerstoreRequest> => {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
1645
|
+
if (_codec == null) {
|
|
1646
|
+
_codec = message<PeerstoreRequest>((obj, writer, opts = {}) => {
|
|
1647
|
+
if (opts.lengthDelimited !== false) {
|
|
1648
|
+
writer.fork()
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
if (obj.type != null) {
|
|
1652
|
+
writer.uint32(8)
|
|
1653
|
+
PeerstoreRequest.Type.codec().encode(obj.type, writer)
|
|
1654
|
+
} else {
|
|
1655
|
+
throw new Error('Protocol error: required field "type" was not found in object')
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
if (obj.id != null) {
|
|
1659
|
+
writer.uint32(18)
|
|
1660
|
+
writer.bytes(obj.id)
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
if (obj.protos != null) {
|
|
1664
|
+
for (const value of obj.protos) {
|
|
1665
|
+
writer.uint32(26)
|
|
1666
|
+
writer.string(value)
|
|
1667
|
+
}
|
|
1668
|
+
} else {
|
|
1669
|
+
throw new Error('Protocol error: required field "protos" was not found in object')
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
if (opts.lengthDelimited !== false) {
|
|
1673
|
+
writer.ldelim()
|
|
1674
|
+
}
|
|
1675
|
+
}, (reader, length) => {
|
|
1676
|
+
const obj: any = {}
|
|
1677
|
+
|
|
1678
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1679
|
+
|
|
1680
|
+
while (reader.pos < end) {
|
|
1681
|
+
const tag = reader.uint32()
|
|
1682
|
+
|
|
1683
|
+
switch (tag >>> 3) {
|
|
1684
|
+
case 1:
|
|
1685
|
+
obj.type = PeerstoreRequest.Type.codec().decode(reader)
|
|
1686
|
+
break
|
|
1687
|
+
case 2:
|
|
1688
|
+
obj.id = reader.bytes()
|
|
1689
|
+
break
|
|
1690
|
+
case 3:
|
|
1691
|
+
obj.protos = obj.protos ?? []
|
|
1692
|
+
obj.protos.push(reader.string())
|
|
1693
|
+
break
|
|
1694
|
+
default:
|
|
1695
|
+
reader.skipType(tag & 7)
|
|
1696
|
+
break
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
obj.protos = obj.protos ?? []
|
|
1701
|
+
|
|
1702
|
+
if (obj.type == null) {
|
|
1703
|
+
throw new Error('Protocol error: value for required field "type" was not found in protobuf')
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
if (obj.protos == null) {
|
|
1707
|
+
throw new Error('Protocol error: value for required field "protos" was not found in protobuf')
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
return obj
|
|
1711
|
+
})
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
return _codec
|
|
576
1715
|
}
|
|
577
1716
|
|
|
578
1717
|
export const encode = (obj: PeerstoreRequest): Uint8Array => {
|
|
579
1718
|
return encodeMessage(obj, PeerstoreRequest.codec())
|
|
580
1719
|
}
|
|
581
1720
|
|
|
582
|
-
export const decode = (buf: Uint8Array): PeerstoreRequest => {
|
|
1721
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): PeerstoreRequest => {
|
|
583
1722
|
return decodeMessage(buf, PeerstoreRequest.codec())
|
|
584
1723
|
}
|
|
585
1724
|
}
|
|
@@ -590,18 +1729,72 @@ export interface PeerstoreResponse {
|
|
|
590
1729
|
}
|
|
591
1730
|
|
|
592
1731
|
export namespace PeerstoreResponse {
|
|
1732
|
+
let _codec: Codec<PeerstoreResponse>
|
|
1733
|
+
|
|
593
1734
|
export const codec = (): Codec<PeerstoreResponse> => {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
1735
|
+
if (_codec == null) {
|
|
1736
|
+
_codec = message<PeerstoreResponse>((obj, writer, opts = {}) => {
|
|
1737
|
+
if (opts.lengthDelimited !== false) {
|
|
1738
|
+
writer.fork()
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
if (obj.peer != null) {
|
|
1742
|
+
writer.uint32(10)
|
|
1743
|
+
PeerInfo.codec().encode(obj.peer, writer)
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
if (obj.protos != null) {
|
|
1747
|
+
for (const value of obj.protos) {
|
|
1748
|
+
writer.uint32(18)
|
|
1749
|
+
writer.string(value)
|
|
1750
|
+
}
|
|
1751
|
+
} else {
|
|
1752
|
+
throw new Error('Protocol error: required field "protos" was not found in object')
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
if (opts.lengthDelimited !== false) {
|
|
1756
|
+
writer.ldelim()
|
|
1757
|
+
}
|
|
1758
|
+
}, (reader, length) => {
|
|
1759
|
+
const obj: any = {}
|
|
1760
|
+
|
|
1761
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
1762
|
+
|
|
1763
|
+
while (reader.pos < end) {
|
|
1764
|
+
const tag = reader.uint32()
|
|
1765
|
+
|
|
1766
|
+
switch (tag >>> 3) {
|
|
1767
|
+
case 1:
|
|
1768
|
+
obj.peer = PeerInfo.codec().decode(reader, reader.uint32())
|
|
1769
|
+
break
|
|
1770
|
+
case 2:
|
|
1771
|
+
obj.protos = obj.protos ?? []
|
|
1772
|
+
obj.protos.push(reader.string())
|
|
1773
|
+
break
|
|
1774
|
+
default:
|
|
1775
|
+
reader.skipType(tag & 7)
|
|
1776
|
+
break
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
obj.protos = obj.protos ?? []
|
|
1781
|
+
|
|
1782
|
+
if (obj.protos == null) {
|
|
1783
|
+
throw new Error('Protocol error: value for required field "protos" was not found in protobuf')
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
return obj
|
|
1787
|
+
})
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
return _codec
|
|
598
1791
|
}
|
|
599
1792
|
|
|
600
1793
|
export const encode = (obj: PeerstoreResponse): Uint8Array => {
|
|
601
1794
|
return encodeMessage(obj, PeerstoreResponse.codec())
|
|
602
1795
|
}
|
|
603
1796
|
|
|
604
|
-
export const decode = (buf: Uint8Array): PeerstoreResponse => {
|
|
1797
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): PeerstoreResponse => {
|
|
605
1798
|
return decodeMessage(buf, PeerstoreResponse.codec())
|
|
606
1799
|
}
|
|
607
1800
|
}
|