@libp2p/daemon-protocol 1.0.0 → 1.0.1
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/dist/index.min.js +3 -0
- package/package.json +7 -5
- package/dist/src/index.d.ts +0 -1528
- package/dist/src/index.js +0 -4449
package/dist/src/index.js
DELETED
|
@@ -1,4449 +0,0 @@
|
|
|
1
|
-
/*eslint-disable*/
|
|
2
|
-
import $protobuf from "protobufjs/minimal.js";
|
|
3
|
-
|
|
4
|
-
// Common aliases
|
|
5
|
-
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
|
6
|
-
|
|
7
|
-
// Exported root namespace
|
|
8
|
-
const $root = $protobuf.roots["libp2p-daemon"] || ($protobuf.roots["libp2p-daemon"] = {});
|
|
9
|
-
|
|
10
|
-
export const Request = $root.Request = (() => {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Properties of a Request.
|
|
14
|
-
* @exports IRequest
|
|
15
|
-
* @interface IRequest
|
|
16
|
-
* @property {Request.Type} type Request type
|
|
17
|
-
* @property {IConnectRequest|null} [connect] Request connect
|
|
18
|
-
* @property {IStreamOpenRequest|null} [streamOpen] Request streamOpen
|
|
19
|
-
* @property {IStreamHandlerRequest|null} [streamHandler] Request streamHandler
|
|
20
|
-
* @property {IDHTRequest|null} [dht] Request dht
|
|
21
|
-
* @property {IConnManagerRequest|null} [connManager] Request connManager
|
|
22
|
-
* @property {IDisconnectRequest|null} [disconnect] Request disconnect
|
|
23
|
-
* @property {IPSRequest|null} [pubsub] Request pubsub
|
|
24
|
-
* @property {IPeerstoreRequest|null} [peerStore] Request peerStore
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Constructs a new Request.
|
|
29
|
-
* @exports Request
|
|
30
|
-
* @classdesc Represents a Request.
|
|
31
|
-
* @implements IRequest
|
|
32
|
-
* @constructor
|
|
33
|
-
* @param {IRequest=} [p] Properties to set
|
|
34
|
-
*/
|
|
35
|
-
function Request(p) {
|
|
36
|
-
if (p)
|
|
37
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
38
|
-
if (p[ks[i]] != null)
|
|
39
|
-
this[ks[i]] = p[ks[i]];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Request type.
|
|
44
|
-
* @member {Request.Type} type
|
|
45
|
-
* @memberof Request
|
|
46
|
-
* @instance
|
|
47
|
-
*/
|
|
48
|
-
Request.prototype.type = 0;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Request connect.
|
|
52
|
-
* @member {IConnectRequest|null|undefined} connect
|
|
53
|
-
* @memberof Request
|
|
54
|
-
* @instance
|
|
55
|
-
*/
|
|
56
|
-
Request.prototype.connect = null;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Request streamOpen.
|
|
60
|
-
* @member {IStreamOpenRequest|null|undefined} streamOpen
|
|
61
|
-
* @memberof Request
|
|
62
|
-
* @instance
|
|
63
|
-
*/
|
|
64
|
-
Request.prototype.streamOpen = null;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Request streamHandler.
|
|
68
|
-
* @member {IStreamHandlerRequest|null|undefined} streamHandler
|
|
69
|
-
* @memberof Request
|
|
70
|
-
* @instance
|
|
71
|
-
*/
|
|
72
|
-
Request.prototype.streamHandler = null;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Request dht.
|
|
76
|
-
* @member {IDHTRequest|null|undefined} dht
|
|
77
|
-
* @memberof Request
|
|
78
|
-
* @instance
|
|
79
|
-
*/
|
|
80
|
-
Request.prototype.dht = null;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Request connManager.
|
|
84
|
-
* @member {IConnManagerRequest|null|undefined} connManager
|
|
85
|
-
* @memberof Request
|
|
86
|
-
* @instance
|
|
87
|
-
*/
|
|
88
|
-
Request.prototype.connManager = null;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Request disconnect.
|
|
92
|
-
* @member {IDisconnectRequest|null|undefined} disconnect
|
|
93
|
-
* @memberof Request
|
|
94
|
-
* @instance
|
|
95
|
-
*/
|
|
96
|
-
Request.prototype.disconnect = null;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Request pubsub.
|
|
100
|
-
* @member {IPSRequest|null|undefined} pubsub
|
|
101
|
-
* @memberof Request
|
|
102
|
-
* @instance
|
|
103
|
-
*/
|
|
104
|
-
Request.prototype.pubsub = null;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Request peerStore.
|
|
108
|
-
* @member {IPeerstoreRequest|null|undefined} peerStore
|
|
109
|
-
* @memberof Request
|
|
110
|
-
* @instance
|
|
111
|
-
*/
|
|
112
|
-
Request.prototype.peerStore = null;
|
|
113
|
-
|
|
114
|
-
// OneOf field names bound to virtual getters and setters
|
|
115
|
-
let $oneOfFields;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Request _connect.
|
|
119
|
-
* @member {"connect"|undefined} _connect
|
|
120
|
-
* @memberof Request
|
|
121
|
-
* @instance
|
|
122
|
-
*/
|
|
123
|
-
Object.defineProperty(Request.prototype, "_connect", {
|
|
124
|
-
get: $util.oneOfGetter($oneOfFields = ["connect"]),
|
|
125
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Request _streamOpen.
|
|
130
|
-
* @member {"streamOpen"|undefined} _streamOpen
|
|
131
|
-
* @memberof Request
|
|
132
|
-
* @instance
|
|
133
|
-
*/
|
|
134
|
-
Object.defineProperty(Request.prototype, "_streamOpen", {
|
|
135
|
-
get: $util.oneOfGetter($oneOfFields = ["streamOpen"]),
|
|
136
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Request _streamHandler.
|
|
141
|
-
* @member {"streamHandler"|undefined} _streamHandler
|
|
142
|
-
* @memberof Request
|
|
143
|
-
* @instance
|
|
144
|
-
*/
|
|
145
|
-
Object.defineProperty(Request.prototype, "_streamHandler", {
|
|
146
|
-
get: $util.oneOfGetter($oneOfFields = ["streamHandler"]),
|
|
147
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Request _dht.
|
|
152
|
-
* @member {"dht"|undefined} _dht
|
|
153
|
-
* @memberof Request
|
|
154
|
-
* @instance
|
|
155
|
-
*/
|
|
156
|
-
Object.defineProperty(Request.prototype, "_dht", {
|
|
157
|
-
get: $util.oneOfGetter($oneOfFields = ["dht"]),
|
|
158
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Request _connManager.
|
|
163
|
-
* @member {"connManager"|undefined} _connManager
|
|
164
|
-
* @memberof Request
|
|
165
|
-
* @instance
|
|
166
|
-
*/
|
|
167
|
-
Object.defineProperty(Request.prototype, "_connManager", {
|
|
168
|
-
get: $util.oneOfGetter($oneOfFields = ["connManager"]),
|
|
169
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Request _disconnect.
|
|
174
|
-
* @member {"disconnect"|undefined} _disconnect
|
|
175
|
-
* @memberof Request
|
|
176
|
-
* @instance
|
|
177
|
-
*/
|
|
178
|
-
Object.defineProperty(Request.prototype, "_disconnect", {
|
|
179
|
-
get: $util.oneOfGetter($oneOfFields = ["disconnect"]),
|
|
180
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Request _pubsub.
|
|
185
|
-
* @member {"pubsub"|undefined} _pubsub
|
|
186
|
-
* @memberof Request
|
|
187
|
-
* @instance
|
|
188
|
-
*/
|
|
189
|
-
Object.defineProperty(Request.prototype, "_pubsub", {
|
|
190
|
-
get: $util.oneOfGetter($oneOfFields = ["pubsub"]),
|
|
191
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Request _peerStore.
|
|
196
|
-
* @member {"peerStore"|undefined} _peerStore
|
|
197
|
-
* @memberof Request
|
|
198
|
-
* @instance
|
|
199
|
-
*/
|
|
200
|
-
Object.defineProperty(Request.prototype, "_peerStore", {
|
|
201
|
-
get: $util.oneOfGetter($oneOfFields = ["peerStore"]),
|
|
202
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Encodes the specified Request message. Does not implicitly {@link Request.verify|verify} messages.
|
|
207
|
-
* @function encode
|
|
208
|
-
* @memberof Request
|
|
209
|
-
* @static
|
|
210
|
-
* @param {IRequest} m Request message or plain object to encode
|
|
211
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
212
|
-
* @returns {$protobuf.Writer} Writer
|
|
213
|
-
*/
|
|
214
|
-
Request.encode = function encode(m, w) {
|
|
215
|
-
if (!w)
|
|
216
|
-
w = $Writer.create();
|
|
217
|
-
w.uint32(8).int32(m.type);
|
|
218
|
-
if (m.connect != null && Object.hasOwnProperty.call(m, "connect"))
|
|
219
|
-
$root.ConnectRequest.encode(m.connect, w.uint32(18).fork()).ldelim();
|
|
220
|
-
if (m.streamOpen != null && Object.hasOwnProperty.call(m, "streamOpen"))
|
|
221
|
-
$root.StreamOpenRequest.encode(m.streamOpen, w.uint32(26).fork()).ldelim();
|
|
222
|
-
if (m.streamHandler != null && Object.hasOwnProperty.call(m, "streamHandler"))
|
|
223
|
-
$root.StreamHandlerRequest.encode(m.streamHandler, w.uint32(34).fork()).ldelim();
|
|
224
|
-
if (m.dht != null && Object.hasOwnProperty.call(m, "dht"))
|
|
225
|
-
$root.DHTRequest.encode(m.dht, w.uint32(42).fork()).ldelim();
|
|
226
|
-
if (m.connManager != null && Object.hasOwnProperty.call(m, "connManager"))
|
|
227
|
-
$root.ConnManagerRequest.encode(m.connManager, w.uint32(50).fork()).ldelim();
|
|
228
|
-
if (m.disconnect != null && Object.hasOwnProperty.call(m, "disconnect"))
|
|
229
|
-
$root.DisconnectRequest.encode(m.disconnect, w.uint32(58).fork()).ldelim();
|
|
230
|
-
if (m.pubsub != null && Object.hasOwnProperty.call(m, "pubsub"))
|
|
231
|
-
$root.PSRequest.encode(m.pubsub, w.uint32(66).fork()).ldelim();
|
|
232
|
-
if (m.peerStore != null && Object.hasOwnProperty.call(m, "peerStore"))
|
|
233
|
-
$root.PeerstoreRequest.encode(m.peerStore, w.uint32(74).fork()).ldelim();
|
|
234
|
-
return w;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Decodes a Request message from the specified reader or buffer.
|
|
239
|
-
* @function decode
|
|
240
|
-
* @memberof Request
|
|
241
|
-
* @static
|
|
242
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
243
|
-
* @param {number} [l] Message length if known beforehand
|
|
244
|
-
* @returns {Request} Request
|
|
245
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
246
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
247
|
-
*/
|
|
248
|
-
Request.decode = function decode(r, l) {
|
|
249
|
-
if (!(r instanceof $Reader))
|
|
250
|
-
r = $Reader.create(r);
|
|
251
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.Request();
|
|
252
|
-
while (r.pos < c) {
|
|
253
|
-
var t = r.uint32();
|
|
254
|
-
switch (t >>> 3) {
|
|
255
|
-
case 1:
|
|
256
|
-
m.type = r.int32();
|
|
257
|
-
break;
|
|
258
|
-
case 2:
|
|
259
|
-
m.connect = $root.ConnectRequest.decode(r, r.uint32());
|
|
260
|
-
break;
|
|
261
|
-
case 3:
|
|
262
|
-
m.streamOpen = $root.StreamOpenRequest.decode(r, r.uint32());
|
|
263
|
-
break;
|
|
264
|
-
case 4:
|
|
265
|
-
m.streamHandler = $root.StreamHandlerRequest.decode(r, r.uint32());
|
|
266
|
-
break;
|
|
267
|
-
case 5:
|
|
268
|
-
m.dht = $root.DHTRequest.decode(r, r.uint32());
|
|
269
|
-
break;
|
|
270
|
-
case 6:
|
|
271
|
-
m.connManager = $root.ConnManagerRequest.decode(r, r.uint32());
|
|
272
|
-
break;
|
|
273
|
-
case 7:
|
|
274
|
-
m.disconnect = $root.DisconnectRequest.decode(r, r.uint32());
|
|
275
|
-
break;
|
|
276
|
-
case 8:
|
|
277
|
-
m.pubsub = $root.PSRequest.decode(r, r.uint32());
|
|
278
|
-
break;
|
|
279
|
-
case 9:
|
|
280
|
-
m.peerStore = $root.PeerstoreRequest.decode(r, r.uint32());
|
|
281
|
-
break;
|
|
282
|
-
default:
|
|
283
|
-
r.skipType(t & 7);
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
if (!m.hasOwnProperty("type"))
|
|
288
|
-
throw $util.ProtocolError("missing required 'type'", { instance: m });
|
|
289
|
-
return m;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Creates a Request message from a plain object. Also converts values to their respective internal types.
|
|
294
|
-
* @function fromObject
|
|
295
|
-
* @memberof Request
|
|
296
|
-
* @static
|
|
297
|
-
* @param {Object.<string,*>} d Plain object
|
|
298
|
-
* @returns {Request} Request
|
|
299
|
-
*/
|
|
300
|
-
Request.fromObject = function fromObject(d) {
|
|
301
|
-
if (d instanceof $root.Request)
|
|
302
|
-
return d;
|
|
303
|
-
var m = new $root.Request();
|
|
304
|
-
switch (d.type) {
|
|
305
|
-
case "IDENTIFY":
|
|
306
|
-
case 0:
|
|
307
|
-
m.type = 0;
|
|
308
|
-
break;
|
|
309
|
-
case "CONNECT":
|
|
310
|
-
case 1:
|
|
311
|
-
m.type = 1;
|
|
312
|
-
break;
|
|
313
|
-
case "STREAM_OPEN":
|
|
314
|
-
case 2:
|
|
315
|
-
m.type = 2;
|
|
316
|
-
break;
|
|
317
|
-
case "STREAM_HANDLER":
|
|
318
|
-
case 3:
|
|
319
|
-
m.type = 3;
|
|
320
|
-
break;
|
|
321
|
-
case "DHT":
|
|
322
|
-
case 4:
|
|
323
|
-
m.type = 4;
|
|
324
|
-
break;
|
|
325
|
-
case "LIST_PEERS":
|
|
326
|
-
case 5:
|
|
327
|
-
m.type = 5;
|
|
328
|
-
break;
|
|
329
|
-
case "CONNMANAGER":
|
|
330
|
-
case 6:
|
|
331
|
-
m.type = 6;
|
|
332
|
-
break;
|
|
333
|
-
case "DISCONNECT":
|
|
334
|
-
case 7:
|
|
335
|
-
m.type = 7;
|
|
336
|
-
break;
|
|
337
|
-
case "PUBSUB":
|
|
338
|
-
case 8:
|
|
339
|
-
m.type = 8;
|
|
340
|
-
break;
|
|
341
|
-
case "PEERSTORE":
|
|
342
|
-
case 9:
|
|
343
|
-
m.type = 9;
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
if (d.connect != null) {
|
|
347
|
-
if (typeof d.connect !== "object")
|
|
348
|
-
throw TypeError(".Request.connect: object expected");
|
|
349
|
-
m.connect = $root.ConnectRequest.fromObject(d.connect);
|
|
350
|
-
}
|
|
351
|
-
if (d.streamOpen != null) {
|
|
352
|
-
if (typeof d.streamOpen !== "object")
|
|
353
|
-
throw TypeError(".Request.streamOpen: object expected");
|
|
354
|
-
m.streamOpen = $root.StreamOpenRequest.fromObject(d.streamOpen);
|
|
355
|
-
}
|
|
356
|
-
if (d.streamHandler != null) {
|
|
357
|
-
if (typeof d.streamHandler !== "object")
|
|
358
|
-
throw TypeError(".Request.streamHandler: object expected");
|
|
359
|
-
m.streamHandler = $root.StreamHandlerRequest.fromObject(d.streamHandler);
|
|
360
|
-
}
|
|
361
|
-
if (d.dht != null) {
|
|
362
|
-
if (typeof d.dht !== "object")
|
|
363
|
-
throw TypeError(".Request.dht: object expected");
|
|
364
|
-
m.dht = $root.DHTRequest.fromObject(d.dht);
|
|
365
|
-
}
|
|
366
|
-
if (d.connManager != null) {
|
|
367
|
-
if (typeof d.connManager !== "object")
|
|
368
|
-
throw TypeError(".Request.connManager: object expected");
|
|
369
|
-
m.connManager = $root.ConnManagerRequest.fromObject(d.connManager);
|
|
370
|
-
}
|
|
371
|
-
if (d.disconnect != null) {
|
|
372
|
-
if (typeof d.disconnect !== "object")
|
|
373
|
-
throw TypeError(".Request.disconnect: object expected");
|
|
374
|
-
m.disconnect = $root.DisconnectRequest.fromObject(d.disconnect);
|
|
375
|
-
}
|
|
376
|
-
if (d.pubsub != null) {
|
|
377
|
-
if (typeof d.pubsub !== "object")
|
|
378
|
-
throw TypeError(".Request.pubsub: object expected");
|
|
379
|
-
m.pubsub = $root.PSRequest.fromObject(d.pubsub);
|
|
380
|
-
}
|
|
381
|
-
if (d.peerStore != null) {
|
|
382
|
-
if (typeof d.peerStore !== "object")
|
|
383
|
-
throw TypeError(".Request.peerStore: object expected");
|
|
384
|
-
m.peerStore = $root.PeerstoreRequest.fromObject(d.peerStore);
|
|
385
|
-
}
|
|
386
|
-
return m;
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Creates a plain object from a Request message. Also converts values to other types if specified.
|
|
391
|
-
* @function toObject
|
|
392
|
-
* @memberof Request
|
|
393
|
-
* @static
|
|
394
|
-
* @param {Request} m Request
|
|
395
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
396
|
-
* @returns {Object.<string,*>} Plain object
|
|
397
|
-
*/
|
|
398
|
-
Request.toObject = function toObject(m, o) {
|
|
399
|
-
if (!o)
|
|
400
|
-
o = {};
|
|
401
|
-
var d = {};
|
|
402
|
-
if (o.defaults) {
|
|
403
|
-
d.type = o.enums === String ? "IDENTIFY" : 0;
|
|
404
|
-
}
|
|
405
|
-
if (m.type != null && m.hasOwnProperty("type")) {
|
|
406
|
-
d.type = o.enums === String ? $root.Request.Type[m.type] : m.type;
|
|
407
|
-
}
|
|
408
|
-
if (m.connect != null && m.hasOwnProperty("connect")) {
|
|
409
|
-
d.connect = $root.ConnectRequest.toObject(m.connect, o);
|
|
410
|
-
if (o.oneofs)
|
|
411
|
-
d._connect = "connect";
|
|
412
|
-
}
|
|
413
|
-
if (m.streamOpen != null && m.hasOwnProperty("streamOpen")) {
|
|
414
|
-
d.streamOpen = $root.StreamOpenRequest.toObject(m.streamOpen, o);
|
|
415
|
-
if (o.oneofs)
|
|
416
|
-
d._streamOpen = "streamOpen";
|
|
417
|
-
}
|
|
418
|
-
if (m.streamHandler != null && m.hasOwnProperty("streamHandler")) {
|
|
419
|
-
d.streamHandler = $root.StreamHandlerRequest.toObject(m.streamHandler, o);
|
|
420
|
-
if (o.oneofs)
|
|
421
|
-
d._streamHandler = "streamHandler";
|
|
422
|
-
}
|
|
423
|
-
if (m.dht != null && m.hasOwnProperty("dht")) {
|
|
424
|
-
d.dht = $root.DHTRequest.toObject(m.dht, o);
|
|
425
|
-
if (o.oneofs)
|
|
426
|
-
d._dht = "dht";
|
|
427
|
-
}
|
|
428
|
-
if (m.connManager != null && m.hasOwnProperty("connManager")) {
|
|
429
|
-
d.connManager = $root.ConnManagerRequest.toObject(m.connManager, o);
|
|
430
|
-
if (o.oneofs)
|
|
431
|
-
d._connManager = "connManager";
|
|
432
|
-
}
|
|
433
|
-
if (m.disconnect != null && m.hasOwnProperty("disconnect")) {
|
|
434
|
-
d.disconnect = $root.DisconnectRequest.toObject(m.disconnect, o);
|
|
435
|
-
if (o.oneofs)
|
|
436
|
-
d._disconnect = "disconnect";
|
|
437
|
-
}
|
|
438
|
-
if (m.pubsub != null && m.hasOwnProperty("pubsub")) {
|
|
439
|
-
d.pubsub = $root.PSRequest.toObject(m.pubsub, o);
|
|
440
|
-
if (o.oneofs)
|
|
441
|
-
d._pubsub = "pubsub";
|
|
442
|
-
}
|
|
443
|
-
if (m.peerStore != null && m.hasOwnProperty("peerStore")) {
|
|
444
|
-
d.peerStore = $root.PeerstoreRequest.toObject(m.peerStore, o);
|
|
445
|
-
if (o.oneofs)
|
|
446
|
-
d._peerStore = "peerStore";
|
|
447
|
-
}
|
|
448
|
-
return d;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Converts this Request to JSON.
|
|
453
|
-
* @function toJSON
|
|
454
|
-
* @memberof Request
|
|
455
|
-
* @instance
|
|
456
|
-
* @returns {Object.<string,*>} JSON object
|
|
457
|
-
*/
|
|
458
|
-
Request.prototype.toJSON = function toJSON() {
|
|
459
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Type enum.
|
|
464
|
-
* @name Request.Type
|
|
465
|
-
* @enum {number}
|
|
466
|
-
* @property {number} IDENTIFY=0 IDENTIFY value
|
|
467
|
-
* @property {number} CONNECT=1 CONNECT value
|
|
468
|
-
* @property {number} STREAM_OPEN=2 STREAM_OPEN value
|
|
469
|
-
* @property {number} STREAM_HANDLER=3 STREAM_HANDLER value
|
|
470
|
-
* @property {number} DHT=4 DHT value
|
|
471
|
-
* @property {number} LIST_PEERS=5 LIST_PEERS value
|
|
472
|
-
* @property {number} CONNMANAGER=6 CONNMANAGER value
|
|
473
|
-
* @property {number} DISCONNECT=7 DISCONNECT value
|
|
474
|
-
* @property {number} PUBSUB=8 PUBSUB value
|
|
475
|
-
* @property {number} PEERSTORE=9 PEERSTORE value
|
|
476
|
-
*/
|
|
477
|
-
Request.Type = (function() {
|
|
478
|
-
const valuesById = {}, values = Object.create(valuesById);
|
|
479
|
-
values[valuesById[0] = "IDENTIFY"] = 0;
|
|
480
|
-
values[valuesById[1] = "CONNECT"] = 1;
|
|
481
|
-
values[valuesById[2] = "STREAM_OPEN"] = 2;
|
|
482
|
-
values[valuesById[3] = "STREAM_HANDLER"] = 3;
|
|
483
|
-
values[valuesById[4] = "DHT"] = 4;
|
|
484
|
-
values[valuesById[5] = "LIST_PEERS"] = 5;
|
|
485
|
-
values[valuesById[6] = "CONNMANAGER"] = 6;
|
|
486
|
-
values[valuesById[7] = "DISCONNECT"] = 7;
|
|
487
|
-
values[valuesById[8] = "PUBSUB"] = 8;
|
|
488
|
-
values[valuesById[9] = "PEERSTORE"] = 9;
|
|
489
|
-
return values;
|
|
490
|
-
})();
|
|
491
|
-
|
|
492
|
-
return Request;
|
|
493
|
-
})();
|
|
494
|
-
|
|
495
|
-
export const Response = $root.Response = (() => {
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* Properties of a Response.
|
|
499
|
-
* @exports IResponse
|
|
500
|
-
* @interface IResponse
|
|
501
|
-
* @property {Response.Type} type Response type
|
|
502
|
-
* @property {IErrorResponse|null} [error] Response error
|
|
503
|
-
* @property {IStreamInfo|null} [streamInfo] Response streamInfo
|
|
504
|
-
* @property {IIdentifyResponse|null} [identify] Response identify
|
|
505
|
-
* @property {IDHTResponse|null} [dht] Response dht
|
|
506
|
-
* @property {Array.<IPeerInfo>|null} [peers] Response peers
|
|
507
|
-
* @property {IPSResponse|null} [pubsub] Response pubsub
|
|
508
|
-
* @property {IPeerstoreResponse|null} [peerStore] Response peerStore
|
|
509
|
-
*/
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Constructs a new Response.
|
|
513
|
-
* @exports Response
|
|
514
|
-
* @classdesc Represents a Response.
|
|
515
|
-
* @implements IResponse
|
|
516
|
-
* @constructor
|
|
517
|
-
* @param {IResponse=} [p] Properties to set
|
|
518
|
-
*/
|
|
519
|
-
function Response(p) {
|
|
520
|
-
this.peers = [];
|
|
521
|
-
if (p)
|
|
522
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
523
|
-
if (p[ks[i]] != null)
|
|
524
|
-
this[ks[i]] = p[ks[i]];
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Response type.
|
|
529
|
-
* @member {Response.Type} type
|
|
530
|
-
* @memberof Response
|
|
531
|
-
* @instance
|
|
532
|
-
*/
|
|
533
|
-
Response.prototype.type = 0;
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Response error.
|
|
537
|
-
* @member {IErrorResponse|null|undefined} error
|
|
538
|
-
* @memberof Response
|
|
539
|
-
* @instance
|
|
540
|
-
*/
|
|
541
|
-
Response.prototype.error = null;
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Response streamInfo.
|
|
545
|
-
* @member {IStreamInfo|null|undefined} streamInfo
|
|
546
|
-
* @memberof Response
|
|
547
|
-
* @instance
|
|
548
|
-
*/
|
|
549
|
-
Response.prototype.streamInfo = null;
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Response identify.
|
|
553
|
-
* @member {IIdentifyResponse|null|undefined} identify
|
|
554
|
-
* @memberof Response
|
|
555
|
-
* @instance
|
|
556
|
-
*/
|
|
557
|
-
Response.prototype.identify = null;
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* Response dht.
|
|
561
|
-
* @member {IDHTResponse|null|undefined} dht
|
|
562
|
-
* @memberof Response
|
|
563
|
-
* @instance
|
|
564
|
-
*/
|
|
565
|
-
Response.prototype.dht = null;
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Response peers.
|
|
569
|
-
* @member {Array.<IPeerInfo>} peers
|
|
570
|
-
* @memberof Response
|
|
571
|
-
* @instance
|
|
572
|
-
*/
|
|
573
|
-
Response.prototype.peers = $util.emptyArray;
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Response pubsub.
|
|
577
|
-
* @member {IPSResponse|null|undefined} pubsub
|
|
578
|
-
* @memberof Response
|
|
579
|
-
* @instance
|
|
580
|
-
*/
|
|
581
|
-
Response.prototype.pubsub = null;
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* Response peerStore.
|
|
585
|
-
* @member {IPeerstoreResponse|null|undefined} peerStore
|
|
586
|
-
* @memberof Response
|
|
587
|
-
* @instance
|
|
588
|
-
*/
|
|
589
|
-
Response.prototype.peerStore = null;
|
|
590
|
-
|
|
591
|
-
// OneOf field names bound to virtual getters and setters
|
|
592
|
-
let $oneOfFields;
|
|
593
|
-
|
|
594
|
-
/**
|
|
595
|
-
* Response _error.
|
|
596
|
-
* @member {"error"|undefined} _error
|
|
597
|
-
* @memberof Response
|
|
598
|
-
* @instance
|
|
599
|
-
*/
|
|
600
|
-
Object.defineProperty(Response.prototype, "_error", {
|
|
601
|
-
get: $util.oneOfGetter($oneOfFields = ["error"]),
|
|
602
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
603
|
-
});
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Response _streamInfo.
|
|
607
|
-
* @member {"streamInfo"|undefined} _streamInfo
|
|
608
|
-
* @memberof Response
|
|
609
|
-
* @instance
|
|
610
|
-
*/
|
|
611
|
-
Object.defineProperty(Response.prototype, "_streamInfo", {
|
|
612
|
-
get: $util.oneOfGetter($oneOfFields = ["streamInfo"]),
|
|
613
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
* Response _identify.
|
|
618
|
-
* @member {"identify"|undefined} _identify
|
|
619
|
-
* @memberof Response
|
|
620
|
-
* @instance
|
|
621
|
-
*/
|
|
622
|
-
Object.defineProperty(Response.prototype, "_identify", {
|
|
623
|
-
get: $util.oneOfGetter($oneOfFields = ["identify"]),
|
|
624
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* Response _dht.
|
|
629
|
-
* @member {"dht"|undefined} _dht
|
|
630
|
-
* @memberof Response
|
|
631
|
-
* @instance
|
|
632
|
-
*/
|
|
633
|
-
Object.defineProperty(Response.prototype, "_dht", {
|
|
634
|
-
get: $util.oneOfGetter($oneOfFields = ["dht"]),
|
|
635
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* Response _pubsub.
|
|
640
|
-
* @member {"pubsub"|undefined} _pubsub
|
|
641
|
-
* @memberof Response
|
|
642
|
-
* @instance
|
|
643
|
-
*/
|
|
644
|
-
Object.defineProperty(Response.prototype, "_pubsub", {
|
|
645
|
-
get: $util.oneOfGetter($oneOfFields = ["pubsub"]),
|
|
646
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
647
|
-
});
|
|
648
|
-
|
|
649
|
-
/**
|
|
650
|
-
* Response _peerStore.
|
|
651
|
-
* @member {"peerStore"|undefined} _peerStore
|
|
652
|
-
* @memberof Response
|
|
653
|
-
* @instance
|
|
654
|
-
*/
|
|
655
|
-
Object.defineProperty(Response.prototype, "_peerStore", {
|
|
656
|
-
get: $util.oneOfGetter($oneOfFields = ["peerStore"]),
|
|
657
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* Encodes the specified Response message. Does not implicitly {@link Response.verify|verify} messages.
|
|
662
|
-
* @function encode
|
|
663
|
-
* @memberof Response
|
|
664
|
-
* @static
|
|
665
|
-
* @param {IResponse} m Response message or plain object to encode
|
|
666
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
667
|
-
* @returns {$protobuf.Writer} Writer
|
|
668
|
-
*/
|
|
669
|
-
Response.encode = function encode(m, w) {
|
|
670
|
-
if (!w)
|
|
671
|
-
w = $Writer.create();
|
|
672
|
-
w.uint32(8).int32(m.type);
|
|
673
|
-
if (m.error != null && Object.hasOwnProperty.call(m, "error"))
|
|
674
|
-
$root.ErrorResponse.encode(m.error, w.uint32(18).fork()).ldelim();
|
|
675
|
-
if (m.streamInfo != null && Object.hasOwnProperty.call(m, "streamInfo"))
|
|
676
|
-
$root.StreamInfo.encode(m.streamInfo, w.uint32(26).fork()).ldelim();
|
|
677
|
-
if (m.identify != null && Object.hasOwnProperty.call(m, "identify"))
|
|
678
|
-
$root.IdentifyResponse.encode(m.identify, w.uint32(34).fork()).ldelim();
|
|
679
|
-
if (m.dht != null && Object.hasOwnProperty.call(m, "dht"))
|
|
680
|
-
$root.DHTResponse.encode(m.dht, w.uint32(42).fork()).ldelim();
|
|
681
|
-
if (m.peers != null && m.peers.length) {
|
|
682
|
-
for (var i = 0; i < m.peers.length; ++i)
|
|
683
|
-
$root.PeerInfo.encode(m.peers[i], w.uint32(50).fork()).ldelim();
|
|
684
|
-
}
|
|
685
|
-
if (m.pubsub != null && Object.hasOwnProperty.call(m, "pubsub"))
|
|
686
|
-
$root.PSResponse.encode(m.pubsub, w.uint32(58).fork()).ldelim();
|
|
687
|
-
if (m.peerStore != null && Object.hasOwnProperty.call(m, "peerStore"))
|
|
688
|
-
$root.PeerstoreResponse.encode(m.peerStore, w.uint32(66).fork()).ldelim();
|
|
689
|
-
return w;
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
/**
|
|
693
|
-
* Decodes a Response message from the specified reader or buffer.
|
|
694
|
-
* @function decode
|
|
695
|
-
* @memberof Response
|
|
696
|
-
* @static
|
|
697
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
698
|
-
* @param {number} [l] Message length if known beforehand
|
|
699
|
-
* @returns {Response} Response
|
|
700
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
701
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
702
|
-
*/
|
|
703
|
-
Response.decode = function decode(r, l) {
|
|
704
|
-
if (!(r instanceof $Reader))
|
|
705
|
-
r = $Reader.create(r);
|
|
706
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.Response();
|
|
707
|
-
while (r.pos < c) {
|
|
708
|
-
var t = r.uint32();
|
|
709
|
-
switch (t >>> 3) {
|
|
710
|
-
case 1:
|
|
711
|
-
m.type = r.int32();
|
|
712
|
-
break;
|
|
713
|
-
case 2:
|
|
714
|
-
m.error = $root.ErrorResponse.decode(r, r.uint32());
|
|
715
|
-
break;
|
|
716
|
-
case 3:
|
|
717
|
-
m.streamInfo = $root.StreamInfo.decode(r, r.uint32());
|
|
718
|
-
break;
|
|
719
|
-
case 4:
|
|
720
|
-
m.identify = $root.IdentifyResponse.decode(r, r.uint32());
|
|
721
|
-
break;
|
|
722
|
-
case 5:
|
|
723
|
-
m.dht = $root.DHTResponse.decode(r, r.uint32());
|
|
724
|
-
break;
|
|
725
|
-
case 6:
|
|
726
|
-
if (!(m.peers && m.peers.length))
|
|
727
|
-
m.peers = [];
|
|
728
|
-
m.peers.push($root.PeerInfo.decode(r, r.uint32()));
|
|
729
|
-
break;
|
|
730
|
-
case 7:
|
|
731
|
-
m.pubsub = $root.PSResponse.decode(r, r.uint32());
|
|
732
|
-
break;
|
|
733
|
-
case 8:
|
|
734
|
-
m.peerStore = $root.PeerstoreResponse.decode(r, r.uint32());
|
|
735
|
-
break;
|
|
736
|
-
default:
|
|
737
|
-
r.skipType(t & 7);
|
|
738
|
-
break;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
if (!m.hasOwnProperty("type"))
|
|
742
|
-
throw $util.ProtocolError("missing required 'type'", { instance: m });
|
|
743
|
-
return m;
|
|
744
|
-
};
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* Creates a Response message from a plain object. Also converts values to their respective internal types.
|
|
748
|
-
* @function fromObject
|
|
749
|
-
* @memberof Response
|
|
750
|
-
* @static
|
|
751
|
-
* @param {Object.<string,*>} d Plain object
|
|
752
|
-
* @returns {Response} Response
|
|
753
|
-
*/
|
|
754
|
-
Response.fromObject = function fromObject(d) {
|
|
755
|
-
if (d instanceof $root.Response)
|
|
756
|
-
return d;
|
|
757
|
-
var m = new $root.Response();
|
|
758
|
-
switch (d.type) {
|
|
759
|
-
case "OK":
|
|
760
|
-
case 0:
|
|
761
|
-
m.type = 0;
|
|
762
|
-
break;
|
|
763
|
-
case "ERROR":
|
|
764
|
-
case 1:
|
|
765
|
-
m.type = 1;
|
|
766
|
-
break;
|
|
767
|
-
}
|
|
768
|
-
if (d.error != null) {
|
|
769
|
-
if (typeof d.error !== "object")
|
|
770
|
-
throw TypeError(".Response.error: object expected");
|
|
771
|
-
m.error = $root.ErrorResponse.fromObject(d.error);
|
|
772
|
-
}
|
|
773
|
-
if (d.streamInfo != null) {
|
|
774
|
-
if (typeof d.streamInfo !== "object")
|
|
775
|
-
throw TypeError(".Response.streamInfo: object expected");
|
|
776
|
-
m.streamInfo = $root.StreamInfo.fromObject(d.streamInfo);
|
|
777
|
-
}
|
|
778
|
-
if (d.identify != null) {
|
|
779
|
-
if (typeof d.identify !== "object")
|
|
780
|
-
throw TypeError(".Response.identify: object expected");
|
|
781
|
-
m.identify = $root.IdentifyResponse.fromObject(d.identify);
|
|
782
|
-
}
|
|
783
|
-
if (d.dht != null) {
|
|
784
|
-
if (typeof d.dht !== "object")
|
|
785
|
-
throw TypeError(".Response.dht: object expected");
|
|
786
|
-
m.dht = $root.DHTResponse.fromObject(d.dht);
|
|
787
|
-
}
|
|
788
|
-
if (d.peers) {
|
|
789
|
-
if (!Array.isArray(d.peers))
|
|
790
|
-
throw TypeError(".Response.peers: array expected");
|
|
791
|
-
m.peers = [];
|
|
792
|
-
for (var i = 0; i < d.peers.length; ++i) {
|
|
793
|
-
if (typeof d.peers[i] !== "object")
|
|
794
|
-
throw TypeError(".Response.peers: object expected");
|
|
795
|
-
m.peers[i] = $root.PeerInfo.fromObject(d.peers[i]);
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
if (d.pubsub != null) {
|
|
799
|
-
if (typeof d.pubsub !== "object")
|
|
800
|
-
throw TypeError(".Response.pubsub: object expected");
|
|
801
|
-
m.pubsub = $root.PSResponse.fromObject(d.pubsub);
|
|
802
|
-
}
|
|
803
|
-
if (d.peerStore != null) {
|
|
804
|
-
if (typeof d.peerStore !== "object")
|
|
805
|
-
throw TypeError(".Response.peerStore: object expected");
|
|
806
|
-
m.peerStore = $root.PeerstoreResponse.fromObject(d.peerStore);
|
|
807
|
-
}
|
|
808
|
-
return m;
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* Creates a plain object from a Response message. Also converts values to other types if specified.
|
|
813
|
-
* @function toObject
|
|
814
|
-
* @memberof Response
|
|
815
|
-
* @static
|
|
816
|
-
* @param {Response} m Response
|
|
817
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
818
|
-
* @returns {Object.<string,*>} Plain object
|
|
819
|
-
*/
|
|
820
|
-
Response.toObject = function toObject(m, o) {
|
|
821
|
-
if (!o)
|
|
822
|
-
o = {};
|
|
823
|
-
var d = {};
|
|
824
|
-
if (o.arrays || o.defaults) {
|
|
825
|
-
d.peers = [];
|
|
826
|
-
}
|
|
827
|
-
if (o.defaults) {
|
|
828
|
-
d.type = o.enums === String ? "OK" : 0;
|
|
829
|
-
}
|
|
830
|
-
if (m.type != null && m.hasOwnProperty("type")) {
|
|
831
|
-
d.type = o.enums === String ? $root.Response.Type[m.type] : m.type;
|
|
832
|
-
}
|
|
833
|
-
if (m.error != null && m.hasOwnProperty("error")) {
|
|
834
|
-
d.error = $root.ErrorResponse.toObject(m.error, o);
|
|
835
|
-
if (o.oneofs)
|
|
836
|
-
d._error = "error";
|
|
837
|
-
}
|
|
838
|
-
if (m.streamInfo != null && m.hasOwnProperty("streamInfo")) {
|
|
839
|
-
d.streamInfo = $root.StreamInfo.toObject(m.streamInfo, o);
|
|
840
|
-
if (o.oneofs)
|
|
841
|
-
d._streamInfo = "streamInfo";
|
|
842
|
-
}
|
|
843
|
-
if (m.identify != null && m.hasOwnProperty("identify")) {
|
|
844
|
-
d.identify = $root.IdentifyResponse.toObject(m.identify, o);
|
|
845
|
-
if (o.oneofs)
|
|
846
|
-
d._identify = "identify";
|
|
847
|
-
}
|
|
848
|
-
if (m.dht != null && m.hasOwnProperty("dht")) {
|
|
849
|
-
d.dht = $root.DHTResponse.toObject(m.dht, o);
|
|
850
|
-
if (o.oneofs)
|
|
851
|
-
d._dht = "dht";
|
|
852
|
-
}
|
|
853
|
-
if (m.peers && m.peers.length) {
|
|
854
|
-
d.peers = [];
|
|
855
|
-
for (var j = 0; j < m.peers.length; ++j) {
|
|
856
|
-
d.peers[j] = $root.PeerInfo.toObject(m.peers[j], o);
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
if (m.pubsub != null && m.hasOwnProperty("pubsub")) {
|
|
860
|
-
d.pubsub = $root.PSResponse.toObject(m.pubsub, o);
|
|
861
|
-
if (o.oneofs)
|
|
862
|
-
d._pubsub = "pubsub";
|
|
863
|
-
}
|
|
864
|
-
if (m.peerStore != null && m.hasOwnProperty("peerStore")) {
|
|
865
|
-
d.peerStore = $root.PeerstoreResponse.toObject(m.peerStore, o);
|
|
866
|
-
if (o.oneofs)
|
|
867
|
-
d._peerStore = "peerStore";
|
|
868
|
-
}
|
|
869
|
-
return d;
|
|
870
|
-
};
|
|
871
|
-
|
|
872
|
-
/**
|
|
873
|
-
* Converts this Response to JSON.
|
|
874
|
-
* @function toJSON
|
|
875
|
-
* @memberof Response
|
|
876
|
-
* @instance
|
|
877
|
-
* @returns {Object.<string,*>} JSON object
|
|
878
|
-
*/
|
|
879
|
-
Response.prototype.toJSON = function toJSON() {
|
|
880
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* Type enum.
|
|
885
|
-
* @name Response.Type
|
|
886
|
-
* @enum {number}
|
|
887
|
-
* @property {number} OK=0 OK value
|
|
888
|
-
* @property {number} ERROR=1 ERROR value
|
|
889
|
-
*/
|
|
890
|
-
Response.Type = (function() {
|
|
891
|
-
const valuesById = {}, values = Object.create(valuesById);
|
|
892
|
-
values[valuesById[0] = "OK"] = 0;
|
|
893
|
-
values[valuesById[1] = "ERROR"] = 1;
|
|
894
|
-
return values;
|
|
895
|
-
})();
|
|
896
|
-
|
|
897
|
-
return Response;
|
|
898
|
-
})();
|
|
899
|
-
|
|
900
|
-
export const IdentifyResponse = $root.IdentifyResponse = (() => {
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* Properties of an IdentifyResponse.
|
|
904
|
-
* @exports IIdentifyResponse
|
|
905
|
-
* @interface IIdentifyResponse
|
|
906
|
-
* @property {Uint8Array} id IdentifyResponse id
|
|
907
|
-
* @property {Array.<Uint8Array>|null} [addrs] IdentifyResponse addrs
|
|
908
|
-
*/
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* Constructs a new IdentifyResponse.
|
|
912
|
-
* @exports IdentifyResponse
|
|
913
|
-
* @classdesc Represents an IdentifyResponse.
|
|
914
|
-
* @implements IIdentifyResponse
|
|
915
|
-
* @constructor
|
|
916
|
-
* @param {IIdentifyResponse=} [p] Properties to set
|
|
917
|
-
*/
|
|
918
|
-
function IdentifyResponse(p) {
|
|
919
|
-
this.addrs = [];
|
|
920
|
-
if (p)
|
|
921
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
922
|
-
if (p[ks[i]] != null)
|
|
923
|
-
this[ks[i]] = p[ks[i]];
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
/**
|
|
927
|
-
* IdentifyResponse id.
|
|
928
|
-
* @member {Uint8Array} id
|
|
929
|
-
* @memberof IdentifyResponse
|
|
930
|
-
* @instance
|
|
931
|
-
*/
|
|
932
|
-
IdentifyResponse.prototype.id = $util.newBuffer([]);
|
|
933
|
-
|
|
934
|
-
/**
|
|
935
|
-
* IdentifyResponse addrs.
|
|
936
|
-
* @member {Array.<Uint8Array>} addrs
|
|
937
|
-
* @memberof IdentifyResponse
|
|
938
|
-
* @instance
|
|
939
|
-
*/
|
|
940
|
-
IdentifyResponse.prototype.addrs = $util.emptyArray;
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* Encodes the specified IdentifyResponse message. Does not implicitly {@link IdentifyResponse.verify|verify} messages.
|
|
944
|
-
* @function encode
|
|
945
|
-
* @memberof IdentifyResponse
|
|
946
|
-
* @static
|
|
947
|
-
* @param {IIdentifyResponse} m IdentifyResponse message or plain object to encode
|
|
948
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
949
|
-
* @returns {$protobuf.Writer} Writer
|
|
950
|
-
*/
|
|
951
|
-
IdentifyResponse.encode = function encode(m, w) {
|
|
952
|
-
if (!w)
|
|
953
|
-
w = $Writer.create();
|
|
954
|
-
w.uint32(10).bytes(m.id);
|
|
955
|
-
if (m.addrs != null && m.addrs.length) {
|
|
956
|
-
for (var i = 0; i < m.addrs.length; ++i)
|
|
957
|
-
w.uint32(18).bytes(m.addrs[i]);
|
|
958
|
-
}
|
|
959
|
-
return w;
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
* Decodes an IdentifyResponse message from the specified reader or buffer.
|
|
964
|
-
* @function decode
|
|
965
|
-
* @memberof IdentifyResponse
|
|
966
|
-
* @static
|
|
967
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
968
|
-
* @param {number} [l] Message length if known beforehand
|
|
969
|
-
* @returns {IdentifyResponse} IdentifyResponse
|
|
970
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
971
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
972
|
-
*/
|
|
973
|
-
IdentifyResponse.decode = function decode(r, l) {
|
|
974
|
-
if (!(r instanceof $Reader))
|
|
975
|
-
r = $Reader.create(r);
|
|
976
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.IdentifyResponse();
|
|
977
|
-
while (r.pos < c) {
|
|
978
|
-
var t = r.uint32();
|
|
979
|
-
switch (t >>> 3) {
|
|
980
|
-
case 1:
|
|
981
|
-
m.id = r.bytes();
|
|
982
|
-
break;
|
|
983
|
-
case 2:
|
|
984
|
-
if (!(m.addrs && m.addrs.length))
|
|
985
|
-
m.addrs = [];
|
|
986
|
-
m.addrs.push(r.bytes());
|
|
987
|
-
break;
|
|
988
|
-
default:
|
|
989
|
-
r.skipType(t & 7);
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
if (!m.hasOwnProperty("id"))
|
|
994
|
-
throw $util.ProtocolError("missing required 'id'", { instance: m });
|
|
995
|
-
return m;
|
|
996
|
-
};
|
|
997
|
-
|
|
998
|
-
/**
|
|
999
|
-
* Creates an IdentifyResponse message from a plain object. Also converts values to their respective internal types.
|
|
1000
|
-
* @function fromObject
|
|
1001
|
-
* @memberof IdentifyResponse
|
|
1002
|
-
* @static
|
|
1003
|
-
* @param {Object.<string,*>} d Plain object
|
|
1004
|
-
* @returns {IdentifyResponse} IdentifyResponse
|
|
1005
|
-
*/
|
|
1006
|
-
IdentifyResponse.fromObject = function fromObject(d) {
|
|
1007
|
-
if (d instanceof $root.IdentifyResponse)
|
|
1008
|
-
return d;
|
|
1009
|
-
var m = new $root.IdentifyResponse();
|
|
1010
|
-
if (d.id != null) {
|
|
1011
|
-
if (typeof d.id === "string")
|
|
1012
|
-
$util.base64.decode(d.id, m.id = $util.newBuffer($util.base64.length(d.id)), 0);
|
|
1013
|
-
else if (d.id.length)
|
|
1014
|
-
m.id = d.id;
|
|
1015
|
-
}
|
|
1016
|
-
if (d.addrs) {
|
|
1017
|
-
if (!Array.isArray(d.addrs))
|
|
1018
|
-
throw TypeError(".IdentifyResponse.addrs: array expected");
|
|
1019
|
-
m.addrs = [];
|
|
1020
|
-
for (var i = 0; i < d.addrs.length; ++i) {
|
|
1021
|
-
if (typeof d.addrs[i] === "string")
|
|
1022
|
-
$util.base64.decode(d.addrs[i], m.addrs[i] = $util.newBuffer($util.base64.length(d.addrs[i])), 0);
|
|
1023
|
-
else if (d.addrs[i].length)
|
|
1024
|
-
m.addrs[i] = d.addrs[i];
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
return m;
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
/**
|
|
1031
|
-
* Creates a plain object from an IdentifyResponse message. Also converts values to other types if specified.
|
|
1032
|
-
* @function toObject
|
|
1033
|
-
* @memberof IdentifyResponse
|
|
1034
|
-
* @static
|
|
1035
|
-
* @param {IdentifyResponse} m IdentifyResponse
|
|
1036
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
1037
|
-
* @returns {Object.<string,*>} Plain object
|
|
1038
|
-
*/
|
|
1039
|
-
IdentifyResponse.toObject = function toObject(m, o) {
|
|
1040
|
-
if (!o)
|
|
1041
|
-
o = {};
|
|
1042
|
-
var d = {};
|
|
1043
|
-
if (o.arrays || o.defaults) {
|
|
1044
|
-
d.addrs = [];
|
|
1045
|
-
}
|
|
1046
|
-
if (o.defaults) {
|
|
1047
|
-
if (o.bytes === String)
|
|
1048
|
-
d.id = "";
|
|
1049
|
-
else {
|
|
1050
|
-
d.id = [];
|
|
1051
|
-
if (o.bytes !== Array)
|
|
1052
|
-
d.id = $util.newBuffer(d.id);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
if (m.id != null && m.hasOwnProperty("id")) {
|
|
1056
|
-
d.id = o.bytes === String ? $util.base64.encode(m.id, 0, m.id.length) : o.bytes === Array ? Array.prototype.slice.call(m.id) : m.id;
|
|
1057
|
-
}
|
|
1058
|
-
if (m.addrs && m.addrs.length) {
|
|
1059
|
-
d.addrs = [];
|
|
1060
|
-
for (var j = 0; j < m.addrs.length; ++j) {
|
|
1061
|
-
d.addrs[j] = o.bytes === String ? $util.base64.encode(m.addrs[j], 0, m.addrs[j].length) : o.bytes === Array ? Array.prototype.slice.call(m.addrs[j]) : m.addrs[j];
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
return d;
|
|
1065
|
-
};
|
|
1066
|
-
|
|
1067
|
-
/**
|
|
1068
|
-
* Converts this IdentifyResponse to JSON.
|
|
1069
|
-
* @function toJSON
|
|
1070
|
-
* @memberof IdentifyResponse
|
|
1071
|
-
* @instance
|
|
1072
|
-
* @returns {Object.<string,*>} JSON object
|
|
1073
|
-
*/
|
|
1074
|
-
IdentifyResponse.prototype.toJSON = function toJSON() {
|
|
1075
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
1076
|
-
};
|
|
1077
|
-
|
|
1078
|
-
return IdentifyResponse;
|
|
1079
|
-
})();
|
|
1080
|
-
|
|
1081
|
-
export const ConnectRequest = $root.ConnectRequest = (() => {
|
|
1082
|
-
|
|
1083
|
-
/**
|
|
1084
|
-
* Properties of a ConnectRequest.
|
|
1085
|
-
* @exports IConnectRequest
|
|
1086
|
-
* @interface IConnectRequest
|
|
1087
|
-
* @property {Uint8Array} peer ConnectRequest peer
|
|
1088
|
-
* @property {Array.<Uint8Array>|null} [addrs] ConnectRequest addrs
|
|
1089
|
-
* @property {number|null} [timeout] ConnectRequest timeout
|
|
1090
|
-
*/
|
|
1091
|
-
|
|
1092
|
-
/**
|
|
1093
|
-
* Constructs a new ConnectRequest.
|
|
1094
|
-
* @exports ConnectRequest
|
|
1095
|
-
* @classdesc Represents a ConnectRequest.
|
|
1096
|
-
* @implements IConnectRequest
|
|
1097
|
-
* @constructor
|
|
1098
|
-
* @param {IConnectRequest=} [p] Properties to set
|
|
1099
|
-
*/
|
|
1100
|
-
function ConnectRequest(p) {
|
|
1101
|
-
this.addrs = [];
|
|
1102
|
-
if (p)
|
|
1103
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
1104
|
-
if (p[ks[i]] != null)
|
|
1105
|
-
this[ks[i]] = p[ks[i]];
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
/**
|
|
1109
|
-
* ConnectRequest peer.
|
|
1110
|
-
* @member {Uint8Array} peer
|
|
1111
|
-
* @memberof ConnectRequest
|
|
1112
|
-
* @instance
|
|
1113
|
-
*/
|
|
1114
|
-
ConnectRequest.prototype.peer = $util.newBuffer([]);
|
|
1115
|
-
|
|
1116
|
-
/**
|
|
1117
|
-
* ConnectRequest addrs.
|
|
1118
|
-
* @member {Array.<Uint8Array>} addrs
|
|
1119
|
-
* @memberof ConnectRequest
|
|
1120
|
-
* @instance
|
|
1121
|
-
*/
|
|
1122
|
-
ConnectRequest.prototype.addrs = $util.emptyArray;
|
|
1123
|
-
|
|
1124
|
-
/**
|
|
1125
|
-
* ConnectRequest timeout.
|
|
1126
|
-
* @member {number|null|undefined} timeout
|
|
1127
|
-
* @memberof ConnectRequest
|
|
1128
|
-
* @instance
|
|
1129
|
-
*/
|
|
1130
|
-
ConnectRequest.prototype.timeout = null;
|
|
1131
|
-
|
|
1132
|
-
// OneOf field names bound to virtual getters and setters
|
|
1133
|
-
let $oneOfFields;
|
|
1134
|
-
|
|
1135
|
-
/**
|
|
1136
|
-
* ConnectRequest _timeout.
|
|
1137
|
-
* @member {"timeout"|undefined} _timeout
|
|
1138
|
-
* @memberof ConnectRequest
|
|
1139
|
-
* @instance
|
|
1140
|
-
*/
|
|
1141
|
-
Object.defineProperty(ConnectRequest.prototype, "_timeout", {
|
|
1142
|
-
get: $util.oneOfGetter($oneOfFields = ["timeout"]),
|
|
1143
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
1144
|
-
});
|
|
1145
|
-
|
|
1146
|
-
/**
|
|
1147
|
-
* Encodes the specified ConnectRequest message. Does not implicitly {@link ConnectRequest.verify|verify} messages.
|
|
1148
|
-
* @function encode
|
|
1149
|
-
* @memberof ConnectRequest
|
|
1150
|
-
* @static
|
|
1151
|
-
* @param {IConnectRequest} m ConnectRequest message or plain object to encode
|
|
1152
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
1153
|
-
* @returns {$protobuf.Writer} Writer
|
|
1154
|
-
*/
|
|
1155
|
-
ConnectRequest.encode = function encode(m, w) {
|
|
1156
|
-
if (!w)
|
|
1157
|
-
w = $Writer.create();
|
|
1158
|
-
w.uint32(10).bytes(m.peer);
|
|
1159
|
-
if (m.addrs != null && m.addrs.length) {
|
|
1160
|
-
for (var i = 0; i < m.addrs.length; ++i)
|
|
1161
|
-
w.uint32(18).bytes(m.addrs[i]);
|
|
1162
|
-
}
|
|
1163
|
-
if (m.timeout != null && Object.hasOwnProperty.call(m, "timeout"))
|
|
1164
|
-
w.uint32(24).int64(m.timeout);
|
|
1165
|
-
return w;
|
|
1166
|
-
};
|
|
1167
|
-
|
|
1168
|
-
/**
|
|
1169
|
-
* Decodes a ConnectRequest message from the specified reader or buffer.
|
|
1170
|
-
* @function decode
|
|
1171
|
-
* @memberof ConnectRequest
|
|
1172
|
-
* @static
|
|
1173
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
1174
|
-
* @param {number} [l] Message length if known beforehand
|
|
1175
|
-
* @returns {ConnectRequest} ConnectRequest
|
|
1176
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1177
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1178
|
-
*/
|
|
1179
|
-
ConnectRequest.decode = function decode(r, l) {
|
|
1180
|
-
if (!(r instanceof $Reader))
|
|
1181
|
-
r = $Reader.create(r);
|
|
1182
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.ConnectRequest();
|
|
1183
|
-
while (r.pos < c) {
|
|
1184
|
-
var t = r.uint32();
|
|
1185
|
-
switch (t >>> 3) {
|
|
1186
|
-
case 1:
|
|
1187
|
-
m.peer = r.bytes();
|
|
1188
|
-
break;
|
|
1189
|
-
case 2:
|
|
1190
|
-
if (!(m.addrs && m.addrs.length))
|
|
1191
|
-
m.addrs = [];
|
|
1192
|
-
m.addrs.push(r.bytes());
|
|
1193
|
-
break;
|
|
1194
|
-
case 3:
|
|
1195
|
-
m.timeout = r.int64();
|
|
1196
|
-
break;
|
|
1197
|
-
default:
|
|
1198
|
-
r.skipType(t & 7);
|
|
1199
|
-
break;
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
if (!m.hasOwnProperty("peer"))
|
|
1203
|
-
throw $util.ProtocolError("missing required 'peer'", { instance: m });
|
|
1204
|
-
return m;
|
|
1205
|
-
};
|
|
1206
|
-
|
|
1207
|
-
/**
|
|
1208
|
-
* Creates a ConnectRequest message from a plain object. Also converts values to their respective internal types.
|
|
1209
|
-
* @function fromObject
|
|
1210
|
-
* @memberof ConnectRequest
|
|
1211
|
-
* @static
|
|
1212
|
-
* @param {Object.<string,*>} d Plain object
|
|
1213
|
-
* @returns {ConnectRequest} ConnectRequest
|
|
1214
|
-
*/
|
|
1215
|
-
ConnectRequest.fromObject = function fromObject(d) {
|
|
1216
|
-
if (d instanceof $root.ConnectRequest)
|
|
1217
|
-
return d;
|
|
1218
|
-
var m = new $root.ConnectRequest();
|
|
1219
|
-
if (d.peer != null) {
|
|
1220
|
-
if (typeof d.peer === "string")
|
|
1221
|
-
$util.base64.decode(d.peer, m.peer = $util.newBuffer($util.base64.length(d.peer)), 0);
|
|
1222
|
-
else if (d.peer.length)
|
|
1223
|
-
m.peer = d.peer;
|
|
1224
|
-
}
|
|
1225
|
-
if (d.addrs) {
|
|
1226
|
-
if (!Array.isArray(d.addrs))
|
|
1227
|
-
throw TypeError(".ConnectRequest.addrs: array expected");
|
|
1228
|
-
m.addrs = [];
|
|
1229
|
-
for (var i = 0; i < d.addrs.length; ++i) {
|
|
1230
|
-
if (typeof d.addrs[i] === "string")
|
|
1231
|
-
$util.base64.decode(d.addrs[i], m.addrs[i] = $util.newBuffer($util.base64.length(d.addrs[i])), 0);
|
|
1232
|
-
else if (d.addrs[i].length)
|
|
1233
|
-
m.addrs[i] = d.addrs[i];
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
if (d.timeout != null) {
|
|
1237
|
-
if ($util.Long)
|
|
1238
|
-
(m.timeout = $util.Long.fromValue(d.timeout)).unsigned = false;
|
|
1239
|
-
else if (typeof d.timeout === "string")
|
|
1240
|
-
m.timeout = parseInt(d.timeout, 10);
|
|
1241
|
-
else if (typeof d.timeout === "number")
|
|
1242
|
-
m.timeout = d.timeout;
|
|
1243
|
-
else if (typeof d.timeout === "object")
|
|
1244
|
-
m.timeout = new $util.LongBits(d.timeout.low >>> 0, d.timeout.high >>> 0).toNumber();
|
|
1245
|
-
}
|
|
1246
|
-
return m;
|
|
1247
|
-
};
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* Creates a plain object from a ConnectRequest message. Also converts values to other types if specified.
|
|
1251
|
-
* @function toObject
|
|
1252
|
-
* @memberof ConnectRequest
|
|
1253
|
-
* @static
|
|
1254
|
-
* @param {ConnectRequest} m ConnectRequest
|
|
1255
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
1256
|
-
* @returns {Object.<string,*>} Plain object
|
|
1257
|
-
*/
|
|
1258
|
-
ConnectRequest.toObject = function toObject(m, o) {
|
|
1259
|
-
if (!o)
|
|
1260
|
-
o = {};
|
|
1261
|
-
var d = {};
|
|
1262
|
-
if (o.arrays || o.defaults) {
|
|
1263
|
-
d.addrs = [];
|
|
1264
|
-
}
|
|
1265
|
-
if (o.defaults) {
|
|
1266
|
-
if (o.bytes === String)
|
|
1267
|
-
d.peer = "";
|
|
1268
|
-
else {
|
|
1269
|
-
d.peer = [];
|
|
1270
|
-
if (o.bytes !== Array)
|
|
1271
|
-
d.peer = $util.newBuffer(d.peer);
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
if (m.peer != null && m.hasOwnProperty("peer")) {
|
|
1275
|
-
d.peer = o.bytes === String ? $util.base64.encode(m.peer, 0, m.peer.length) : o.bytes === Array ? Array.prototype.slice.call(m.peer) : m.peer;
|
|
1276
|
-
}
|
|
1277
|
-
if (m.addrs && m.addrs.length) {
|
|
1278
|
-
d.addrs = [];
|
|
1279
|
-
for (var j = 0; j < m.addrs.length; ++j) {
|
|
1280
|
-
d.addrs[j] = o.bytes === String ? $util.base64.encode(m.addrs[j], 0, m.addrs[j].length) : o.bytes === Array ? Array.prototype.slice.call(m.addrs[j]) : m.addrs[j];
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
if (m.timeout != null && m.hasOwnProperty("timeout")) {
|
|
1284
|
-
if (typeof m.timeout === "number")
|
|
1285
|
-
d.timeout = o.longs === String ? String(m.timeout) : m.timeout;
|
|
1286
|
-
else
|
|
1287
|
-
d.timeout = o.longs === String ? $util.Long.prototype.toString.call(m.timeout) : o.longs === Number ? new $util.LongBits(m.timeout.low >>> 0, m.timeout.high >>> 0).toNumber() : m.timeout;
|
|
1288
|
-
if (o.oneofs)
|
|
1289
|
-
d._timeout = "timeout";
|
|
1290
|
-
}
|
|
1291
|
-
return d;
|
|
1292
|
-
};
|
|
1293
|
-
|
|
1294
|
-
/**
|
|
1295
|
-
* Converts this ConnectRequest to JSON.
|
|
1296
|
-
* @function toJSON
|
|
1297
|
-
* @memberof ConnectRequest
|
|
1298
|
-
* @instance
|
|
1299
|
-
* @returns {Object.<string,*>} JSON object
|
|
1300
|
-
*/
|
|
1301
|
-
ConnectRequest.prototype.toJSON = function toJSON() {
|
|
1302
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
1303
|
-
};
|
|
1304
|
-
|
|
1305
|
-
return ConnectRequest;
|
|
1306
|
-
})();
|
|
1307
|
-
|
|
1308
|
-
export const StreamOpenRequest = $root.StreamOpenRequest = (() => {
|
|
1309
|
-
|
|
1310
|
-
/**
|
|
1311
|
-
* Properties of a StreamOpenRequest.
|
|
1312
|
-
* @exports IStreamOpenRequest
|
|
1313
|
-
* @interface IStreamOpenRequest
|
|
1314
|
-
* @property {Uint8Array} peer StreamOpenRequest peer
|
|
1315
|
-
* @property {Array.<string>|null} [proto] StreamOpenRequest proto
|
|
1316
|
-
* @property {number|null} [timeout] StreamOpenRequest timeout
|
|
1317
|
-
*/
|
|
1318
|
-
|
|
1319
|
-
/**
|
|
1320
|
-
* Constructs a new StreamOpenRequest.
|
|
1321
|
-
* @exports StreamOpenRequest
|
|
1322
|
-
* @classdesc Represents a StreamOpenRequest.
|
|
1323
|
-
* @implements IStreamOpenRequest
|
|
1324
|
-
* @constructor
|
|
1325
|
-
* @param {IStreamOpenRequest=} [p] Properties to set
|
|
1326
|
-
*/
|
|
1327
|
-
function StreamOpenRequest(p) {
|
|
1328
|
-
this.proto = [];
|
|
1329
|
-
if (p)
|
|
1330
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
1331
|
-
if (p[ks[i]] != null)
|
|
1332
|
-
this[ks[i]] = p[ks[i]];
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
/**
|
|
1336
|
-
* StreamOpenRequest peer.
|
|
1337
|
-
* @member {Uint8Array} peer
|
|
1338
|
-
* @memberof StreamOpenRequest
|
|
1339
|
-
* @instance
|
|
1340
|
-
*/
|
|
1341
|
-
StreamOpenRequest.prototype.peer = $util.newBuffer([]);
|
|
1342
|
-
|
|
1343
|
-
/**
|
|
1344
|
-
* StreamOpenRequest proto.
|
|
1345
|
-
* @member {Array.<string>} proto
|
|
1346
|
-
* @memberof StreamOpenRequest
|
|
1347
|
-
* @instance
|
|
1348
|
-
*/
|
|
1349
|
-
StreamOpenRequest.prototype.proto = $util.emptyArray;
|
|
1350
|
-
|
|
1351
|
-
/**
|
|
1352
|
-
* StreamOpenRequest timeout.
|
|
1353
|
-
* @member {number|null|undefined} timeout
|
|
1354
|
-
* @memberof StreamOpenRequest
|
|
1355
|
-
* @instance
|
|
1356
|
-
*/
|
|
1357
|
-
StreamOpenRequest.prototype.timeout = null;
|
|
1358
|
-
|
|
1359
|
-
// OneOf field names bound to virtual getters and setters
|
|
1360
|
-
let $oneOfFields;
|
|
1361
|
-
|
|
1362
|
-
/**
|
|
1363
|
-
* StreamOpenRequest _timeout.
|
|
1364
|
-
* @member {"timeout"|undefined} _timeout
|
|
1365
|
-
* @memberof StreamOpenRequest
|
|
1366
|
-
* @instance
|
|
1367
|
-
*/
|
|
1368
|
-
Object.defineProperty(StreamOpenRequest.prototype, "_timeout", {
|
|
1369
|
-
get: $util.oneOfGetter($oneOfFields = ["timeout"]),
|
|
1370
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
1371
|
-
});
|
|
1372
|
-
|
|
1373
|
-
/**
|
|
1374
|
-
* Encodes the specified StreamOpenRequest message. Does not implicitly {@link StreamOpenRequest.verify|verify} messages.
|
|
1375
|
-
* @function encode
|
|
1376
|
-
* @memberof StreamOpenRequest
|
|
1377
|
-
* @static
|
|
1378
|
-
* @param {IStreamOpenRequest} m StreamOpenRequest message or plain object to encode
|
|
1379
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
1380
|
-
* @returns {$protobuf.Writer} Writer
|
|
1381
|
-
*/
|
|
1382
|
-
StreamOpenRequest.encode = function encode(m, w) {
|
|
1383
|
-
if (!w)
|
|
1384
|
-
w = $Writer.create();
|
|
1385
|
-
w.uint32(10).bytes(m.peer);
|
|
1386
|
-
if (m.proto != null && m.proto.length) {
|
|
1387
|
-
for (var i = 0; i < m.proto.length; ++i)
|
|
1388
|
-
w.uint32(18).string(m.proto[i]);
|
|
1389
|
-
}
|
|
1390
|
-
if (m.timeout != null && Object.hasOwnProperty.call(m, "timeout"))
|
|
1391
|
-
w.uint32(24).int64(m.timeout);
|
|
1392
|
-
return w;
|
|
1393
|
-
};
|
|
1394
|
-
|
|
1395
|
-
/**
|
|
1396
|
-
* Decodes a StreamOpenRequest message from the specified reader or buffer.
|
|
1397
|
-
* @function decode
|
|
1398
|
-
* @memberof StreamOpenRequest
|
|
1399
|
-
* @static
|
|
1400
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
1401
|
-
* @param {number} [l] Message length if known beforehand
|
|
1402
|
-
* @returns {StreamOpenRequest} StreamOpenRequest
|
|
1403
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1404
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1405
|
-
*/
|
|
1406
|
-
StreamOpenRequest.decode = function decode(r, l) {
|
|
1407
|
-
if (!(r instanceof $Reader))
|
|
1408
|
-
r = $Reader.create(r);
|
|
1409
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.StreamOpenRequest();
|
|
1410
|
-
while (r.pos < c) {
|
|
1411
|
-
var t = r.uint32();
|
|
1412
|
-
switch (t >>> 3) {
|
|
1413
|
-
case 1:
|
|
1414
|
-
m.peer = r.bytes();
|
|
1415
|
-
break;
|
|
1416
|
-
case 2:
|
|
1417
|
-
if (!(m.proto && m.proto.length))
|
|
1418
|
-
m.proto = [];
|
|
1419
|
-
m.proto.push(r.string());
|
|
1420
|
-
break;
|
|
1421
|
-
case 3:
|
|
1422
|
-
m.timeout = r.int64();
|
|
1423
|
-
break;
|
|
1424
|
-
default:
|
|
1425
|
-
r.skipType(t & 7);
|
|
1426
|
-
break;
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
if (!m.hasOwnProperty("peer"))
|
|
1430
|
-
throw $util.ProtocolError("missing required 'peer'", { instance: m });
|
|
1431
|
-
return m;
|
|
1432
|
-
};
|
|
1433
|
-
|
|
1434
|
-
/**
|
|
1435
|
-
* Creates a StreamOpenRequest message from a plain object. Also converts values to their respective internal types.
|
|
1436
|
-
* @function fromObject
|
|
1437
|
-
* @memberof StreamOpenRequest
|
|
1438
|
-
* @static
|
|
1439
|
-
* @param {Object.<string,*>} d Plain object
|
|
1440
|
-
* @returns {StreamOpenRequest} StreamOpenRequest
|
|
1441
|
-
*/
|
|
1442
|
-
StreamOpenRequest.fromObject = function fromObject(d) {
|
|
1443
|
-
if (d instanceof $root.StreamOpenRequest)
|
|
1444
|
-
return d;
|
|
1445
|
-
var m = new $root.StreamOpenRequest();
|
|
1446
|
-
if (d.peer != null) {
|
|
1447
|
-
if (typeof d.peer === "string")
|
|
1448
|
-
$util.base64.decode(d.peer, m.peer = $util.newBuffer($util.base64.length(d.peer)), 0);
|
|
1449
|
-
else if (d.peer.length)
|
|
1450
|
-
m.peer = d.peer;
|
|
1451
|
-
}
|
|
1452
|
-
if (d.proto) {
|
|
1453
|
-
if (!Array.isArray(d.proto))
|
|
1454
|
-
throw TypeError(".StreamOpenRequest.proto: array expected");
|
|
1455
|
-
m.proto = [];
|
|
1456
|
-
for (var i = 0; i < d.proto.length; ++i) {
|
|
1457
|
-
m.proto[i] = String(d.proto[i]);
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
if (d.timeout != null) {
|
|
1461
|
-
if ($util.Long)
|
|
1462
|
-
(m.timeout = $util.Long.fromValue(d.timeout)).unsigned = false;
|
|
1463
|
-
else if (typeof d.timeout === "string")
|
|
1464
|
-
m.timeout = parseInt(d.timeout, 10);
|
|
1465
|
-
else if (typeof d.timeout === "number")
|
|
1466
|
-
m.timeout = d.timeout;
|
|
1467
|
-
else if (typeof d.timeout === "object")
|
|
1468
|
-
m.timeout = new $util.LongBits(d.timeout.low >>> 0, d.timeout.high >>> 0).toNumber();
|
|
1469
|
-
}
|
|
1470
|
-
return m;
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
|
-
/**
|
|
1474
|
-
* Creates a plain object from a StreamOpenRequest message. Also converts values to other types if specified.
|
|
1475
|
-
* @function toObject
|
|
1476
|
-
* @memberof StreamOpenRequest
|
|
1477
|
-
* @static
|
|
1478
|
-
* @param {StreamOpenRequest} m StreamOpenRequest
|
|
1479
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
1480
|
-
* @returns {Object.<string,*>} Plain object
|
|
1481
|
-
*/
|
|
1482
|
-
StreamOpenRequest.toObject = function toObject(m, o) {
|
|
1483
|
-
if (!o)
|
|
1484
|
-
o = {};
|
|
1485
|
-
var d = {};
|
|
1486
|
-
if (o.arrays || o.defaults) {
|
|
1487
|
-
d.proto = [];
|
|
1488
|
-
}
|
|
1489
|
-
if (o.defaults) {
|
|
1490
|
-
if (o.bytes === String)
|
|
1491
|
-
d.peer = "";
|
|
1492
|
-
else {
|
|
1493
|
-
d.peer = [];
|
|
1494
|
-
if (o.bytes !== Array)
|
|
1495
|
-
d.peer = $util.newBuffer(d.peer);
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
if (m.peer != null && m.hasOwnProperty("peer")) {
|
|
1499
|
-
d.peer = o.bytes === String ? $util.base64.encode(m.peer, 0, m.peer.length) : o.bytes === Array ? Array.prototype.slice.call(m.peer) : m.peer;
|
|
1500
|
-
}
|
|
1501
|
-
if (m.proto && m.proto.length) {
|
|
1502
|
-
d.proto = [];
|
|
1503
|
-
for (var j = 0; j < m.proto.length; ++j) {
|
|
1504
|
-
d.proto[j] = m.proto[j];
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
if (m.timeout != null && m.hasOwnProperty("timeout")) {
|
|
1508
|
-
if (typeof m.timeout === "number")
|
|
1509
|
-
d.timeout = o.longs === String ? String(m.timeout) : m.timeout;
|
|
1510
|
-
else
|
|
1511
|
-
d.timeout = o.longs === String ? $util.Long.prototype.toString.call(m.timeout) : o.longs === Number ? new $util.LongBits(m.timeout.low >>> 0, m.timeout.high >>> 0).toNumber() : m.timeout;
|
|
1512
|
-
if (o.oneofs)
|
|
1513
|
-
d._timeout = "timeout";
|
|
1514
|
-
}
|
|
1515
|
-
return d;
|
|
1516
|
-
};
|
|
1517
|
-
|
|
1518
|
-
/**
|
|
1519
|
-
* Converts this StreamOpenRequest to JSON.
|
|
1520
|
-
* @function toJSON
|
|
1521
|
-
* @memberof StreamOpenRequest
|
|
1522
|
-
* @instance
|
|
1523
|
-
* @returns {Object.<string,*>} JSON object
|
|
1524
|
-
*/
|
|
1525
|
-
StreamOpenRequest.prototype.toJSON = function toJSON() {
|
|
1526
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
1527
|
-
};
|
|
1528
|
-
|
|
1529
|
-
return StreamOpenRequest;
|
|
1530
|
-
})();
|
|
1531
|
-
|
|
1532
|
-
export const StreamHandlerRequest = $root.StreamHandlerRequest = (() => {
|
|
1533
|
-
|
|
1534
|
-
/**
|
|
1535
|
-
* Properties of a StreamHandlerRequest.
|
|
1536
|
-
* @exports IStreamHandlerRequest
|
|
1537
|
-
* @interface IStreamHandlerRequest
|
|
1538
|
-
* @property {Uint8Array} addr StreamHandlerRequest addr
|
|
1539
|
-
* @property {Array.<string>|null} [proto] StreamHandlerRequest proto
|
|
1540
|
-
*/
|
|
1541
|
-
|
|
1542
|
-
/**
|
|
1543
|
-
* Constructs a new StreamHandlerRequest.
|
|
1544
|
-
* @exports StreamHandlerRequest
|
|
1545
|
-
* @classdesc Represents a StreamHandlerRequest.
|
|
1546
|
-
* @implements IStreamHandlerRequest
|
|
1547
|
-
* @constructor
|
|
1548
|
-
* @param {IStreamHandlerRequest=} [p] Properties to set
|
|
1549
|
-
*/
|
|
1550
|
-
function StreamHandlerRequest(p) {
|
|
1551
|
-
this.proto = [];
|
|
1552
|
-
if (p)
|
|
1553
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
1554
|
-
if (p[ks[i]] != null)
|
|
1555
|
-
this[ks[i]] = p[ks[i]];
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
/**
|
|
1559
|
-
* StreamHandlerRequest addr.
|
|
1560
|
-
* @member {Uint8Array} addr
|
|
1561
|
-
* @memberof StreamHandlerRequest
|
|
1562
|
-
* @instance
|
|
1563
|
-
*/
|
|
1564
|
-
StreamHandlerRequest.prototype.addr = $util.newBuffer([]);
|
|
1565
|
-
|
|
1566
|
-
/**
|
|
1567
|
-
* StreamHandlerRequest proto.
|
|
1568
|
-
* @member {Array.<string>} proto
|
|
1569
|
-
* @memberof StreamHandlerRequest
|
|
1570
|
-
* @instance
|
|
1571
|
-
*/
|
|
1572
|
-
StreamHandlerRequest.prototype.proto = $util.emptyArray;
|
|
1573
|
-
|
|
1574
|
-
/**
|
|
1575
|
-
* Encodes the specified StreamHandlerRequest message. Does not implicitly {@link StreamHandlerRequest.verify|verify} messages.
|
|
1576
|
-
* @function encode
|
|
1577
|
-
* @memberof StreamHandlerRequest
|
|
1578
|
-
* @static
|
|
1579
|
-
* @param {IStreamHandlerRequest} m StreamHandlerRequest message or plain object to encode
|
|
1580
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
1581
|
-
* @returns {$protobuf.Writer} Writer
|
|
1582
|
-
*/
|
|
1583
|
-
StreamHandlerRequest.encode = function encode(m, w) {
|
|
1584
|
-
if (!w)
|
|
1585
|
-
w = $Writer.create();
|
|
1586
|
-
w.uint32(10).bytes(m.addr);
|
|
1587
|
-
if (m.proto != null && m.proto.length) {
|
|
1588
|
-
for (var i = 0; i < m.proto.length; ++i)
|
|
1589
|
-
w.uint32(18).string(m.proto[i]);
|
|
1590
|
-
}
|
|
1591
|
-
return w;
|
|
1592
|
-
};
|
|
1593
|
-
|
|
1594
|
-
/**
|
|
1595
|
-
* Decodes a StreamHandlerRequest message from the specified reader or buffer.
|
|
1596
|
-
* @function decode
|
|
1597
|
-
* @memberof StreamHandlerRequest
|
|
1598
|
-
* @static
|
|
1599
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
1600
|
-
* @param {number} [l] Message length if known beforehand
|
|
1601
|
-
* @returns {StreamHandlerRequest} StreamHandlerRequest
|
|
1602
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1603
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1604
|
-
*/
|
|
1605
|
-
StreamHandlerRequest.decode = function decode(r, l) {
|
|
1606
|
-
if (!(r instanceof $Reader))
|
|
1607
|
-
r = $Reader.create(r);
|
|
1608
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.StreamHandlerRequest();
|
|
1609
|
-
while (r.pos < c) {
|
|
1610
|
-
var t = r.uint32();
|
|
1611
|
-
switch (t >>> 3) {
|
|
1612
|
-
case 1:
|
|
1613
|
-
m.addr = r.bytes();
|
|
1614
|
-
break;
|
|
1615
|
-
case 2:
|
|
1616
|
-
if (!(m.proto && m.proto.length))
|
|
1617
|
-
m.proto = [];
|
|
1618
|
-
m.proto.push(r.string());
|
|
1619
|
-
break;
|
|
1620
|
-
default:
|
|
1621
|
-
r.skipType(t & 7);
|
|
1622
|
-
break;
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
if (!m.hasOwnProperty("addr"))
|
|
1626
|
-
throw $util.ProtocolError("missing required 'addr'", { instance: m });
|
|
1627
|
-
return m;
|
|
1628
|
-
};
|
|
1629
|
-
|
|
1630
|
-
/**
|
|
1631
|
-
* Creates a StreamHandlerRequest message from a plain object. Also converts values to their respective internal types.
|
|
1632
|
-
* @function fromObject
|
|
1633
|
-
* @memberof StreamHandlerRequest
|
|
1634
|
-
* @static
|
|
1635
|
-
* @param {Object.<string,*>} d Plain object
|
|
1636
|
-
* @returns {StreamHandlerRequest} StreamHandlerRequest
|
|
1637
|
-
*/
|
|
1638
|
-
StreamHandlerRequest.fromObject = function fromObject(d) {
|
|
1639
|
-
if (d instanceof $root.StreamHandlerRequest)
|
|
1640
|
-
return d;
|
|
1641
|
-
var m = new $root.StreamHandlerRequest();
|
|
1642
|
-
if (d.addr != null) {
|
|
1643
|
-
if (typeof d.addr === "string")
|
|
1644
|
-
$util.base64.decode(d.addr, m.addr = $util.newBuffer($util.base64.length(d.addr)), 0);
|
|
1645
|
-
else if (d.addr.length)
|
|
1646
|
-
m.addr = d.addr;
|
|
1647
|
-
}
|
|
1648
|
-
if (d.proto) {
|
|
1649
|
-
if (!Array.isArray(d.proto))
|
|
1650
|
-
throw TypeError(".StreamHandlerRequest.proto: array expected");
|
|
1651
|
-
m.proto = [];
|
|
1652
|
-
for (var i = 0; i < d.proto.length; ++i) {
|
|
1653
|
-
m.proto[i] = String(d.proto[i]);
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
return m;
|
|
1657
|
-
};
|
|
1658
|
-
|
|
1659
|
-
/**
|
|
1660
|
-
* Creates a plain object from a StreamHandlerRequest message. Also converts values to other types if specified.
|
|
1661
|
-
* @function toObject
|
|
1662
|
-
* @memberof StreamHandlerRequest
|
|
1663
|
-
* @static
|
|
1664
|
-
* @param {StreamHandlerRequest} m StreamHandlerRequest
|
|
1665
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
1666
|
-
* @returns {Object.<string,*>} Plain object
|
|
1667
|
-
*/
|
|
1668
|
-
StreamHandlerRequest.toObject = function toObject(m, o) {
|
|
1669
|
-
if (!o)
|
|
1670
|
-
o = {};
|
|
1671
|
-
var d = {};
|
|
1672
|
-
if (o.arrays || o.defaults) {
|
|
1673
|
-
d.proto = [];
|
|
1674
|
-
}
|
|
1675
|
-
if (o.defaults) {
|
|
1676
|
-
if (o.bytes === String)
|
|
1677
|
-
d.addr = "";
|
|
1678
|
-
else {
|
|
1679
|
-
d.addr = [];
|
|
1680
|
-
if (o.bytes !== Array)
|
|
1681
|
-
d.addr = $util.newBuffer(d.addr);
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
if (m.addr != null && m.hasOwnProperty("addr")) {
|
|
1685
|
-
d.addr = o.bytes === String ? $util.base64.encode(m.addr, 0, m.addr.length) : o.bytes === Array ? Array.prototype.slice.call(m.addr) : m.addr;
|
|
1686
|
-
}
|
|
1687
|
-
if (m.proto && m.proto.length) {
|
|
1688
|
-
d.proto = [];
|
|
1689
|
-
for (var j = 0; j < m.proto.length; ++j) {
|
|
1690
|
-
d.proto[j] = m.proto[j];
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
return d;
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
/**
|
|
1697
|
-
* Converts this StreamHandlerRequest to JSON.
|
|
1698
|
-
* @function toJSON
|
|
1699
|
-
* @memberof StreamHandlerRequest
|
|
1700
|
-
* @instance
|
|
1701
|
-
* @returns {Object.<string,*>} JSON object
|
|
1702
|
-
*/
|
|
1703
|
-
StreamHandlerRequest.prototype.toJSON = function toJSON() {
|
|
1704
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
1705
|
-
};
|
|
1706
|
-
|
|
1707
|
-
return StreamHandlerRequest;
|
|
1708
|
-
})();
|
|
1709
|
-
|
|
1710
|
-
export const ErrorResponse = $root.ErrorResponse = (() => {
|
|
1711
|
-
|
|
1712
|
-
/**
|
|
1713
|
-
* Properties of an ErrorResponse.
|
|
1714
|
-
* @exports IErrorResponse
|
|
1715
|
-
* @interface IErrorResponse
|
|
1716
|
-
* @property {string} msg ErrorResponse msg
|
|
1717
|
-
*/
|
|
1718
|
-
|
|
1719
|
-
/**
|
|
1720
|
-
* Constructs a new ErrorResponse.
|
|
1721
|
-
* @exports ErrorResponse
|
|
1722
|
-
* @classdesc Represents an ErrorResponse.
|
|
1723
|
-
* @implements IErrorResponse
|
|
1724
|
-
* @constructor
|
|
1725
|
-
* @param {IErrorResponse=} [p] Properties to set
|
|
1726
|
-
*/
|
|
1727
|
-
function ErrorResponse(p) {
|
|
1728
|
-
if (p)
|
|
1729
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
1730
|
-
if (p[ks[i]] != null)
|
|
1731
|
-
this[ks[i]] = p[ks[i]];
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
/**
|
|
1735
|
-
* ErrorResponse msg.
|
|
1736
|
-
* @member {string} msg
|
|
1737
|
-
* @memberof ErrorResponse
|
|
1738
|
-
* @instance
|
|
1739
|
-
*/
|
|
1740
|
-
ErrorResponse.prototype.msg = "";
|
|
1741
|
-
|
|
1742
|
-
/**
|
|
1743
|
-
* Encodes the specified ErrorResponse message. Does not implicitly {@link ErrorResponse.verify|verify} messages.
|
|
1744
|
-
* @function encode
|
|
1745
|
-
* @memberof ErrorResponse
|
|
1746
|
-
* @static
|
|
1747
|
-
* @param {IErrorResponse} m ErrorResponse message or plain object to encode
|
|
1748
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
1749
|
-
* @returns {$protobuf.Writer} Writer
|
|
1750
|
-
*/
|
|
1751
|
-
ErrorResponse.encode = function encode(m, w) {
|
|
1752
|
-
if (!w)
|
|
1753
|
-
w = $Writer.create();
|
|
1754
|
-
w.uint32(10).string(m.msg);
|
|
1755
|
-
return w;
|
|
1756
|
-
};
|
|
1757
|
-
|
|
1758
|
-
/**
|
|
1759
|
-
* Decodes an ErrorResponse message from the specified reader or buffer.
|
|
1760
|
-
* @function decode
|
|
1761
|
-
* @memberof ErrorResponse
|
|
1762
|
-
* @static
|
|
1763
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
1764
|
-
* @param {number} [l] Message length if known beforehand
|
|
1765
|
-
* @returns {ErrorResponse} ErrorResponse
|
|
1766
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1767
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1768
|
-
*/
|
|
1769
|
-
ErrorResponse.decode = function decode(r, l) {
|
|
1770
|
-
if (!(r instanceof $Reader))
|
|
1771
|
-
r = $Reader.create(r);
|
|
1772
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.ErrorResponse();
|
|
1773
|
-
while (r.pos < c) {
|
|
1774
|
-
var t = r.uint32();
|
|
1775
|
-
switch (t >>> 3) {
|
|
1776
|
-
case 1:
|
|
1777
|
-
m.msg = r.string();
|
|
1778
|
-
break;
|
|
1779
|
-
default:
|
|
1780
|
-
r.skipType(t & 7);
|
|
1781
|
-
break;
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
if (!m.hasOwnProperty("msg"))
|
|
1785
|
-
throw $util.ProtocolError("missing required 'msg'", { instance: m });
|
|
1786
|
-
return m;
|
|
1787
|
-
};
|
|
1788
|
-
|
|
1789
|
-
/**
|
|
1790
|
-
* Creates an ErrorResponse message from a plain object. Also converts values to their respective internal types.
|
|
1791
|
-
* @function fromObject
|
|
1792
|
-
* @memberof ErrorResponse
|
|
1793
|
-
* @static
|
|
1794
|
-
* @param {Object.<string,*>} d Plain object
|
|
1795
|
-
* @returns {ErrorResponse} ErrorResponse
|
|
1796
|
-
*/
|
|
1797
|
-
ErrorResponse.fromObject = function fromObject(d) {
|
|
1798
|
-
if (d instanceof $root.ErrorResponse)
|
|
1799
|
-
return d;
|
|
1800
|
-
var m = new $root.ErrorResponse();
|
|
1801
|
-
if (d.msg != null) {
|
|
1802
|
-
m.msg = String(d.msg);
|
|
1803
|
-
}
|
|
1804
|
-
return m;
|
|
1805
|
-
};
|
|
1806
|
-
|
|
1807
|
-
/**
|
|
1808
|
-
* Creates a plain object from an ErrorResponse message. Also converts values to other types if specified.
|
|
1809
|
-
* @function toObject
|
|
1810
|
-
* @memberof ErrorResponse
|
|
1811
|
-
* @static
|
|
1812
|
-
* @param {ErrorResponse} m ErrorResponse
|
|
1813
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
1814
|
-
* @returns {Object.<string,*>} Plain object
|
|
1815
|
-
*/
|
|
1816
|
-
ErrorResponse.toObject = function toObject(m, o) {
|
|
1817
|
-
if (!o)
|
|
1818
|
-
o = {};
|
|
1819
|
-
var d = {};
|
|
1820
|
-
if (o.defaults) {
|
|
1821
|
-
d.msg = "";
|
|
1822
|
-
}
|
|
1823
|
-
if (m.msg != null && m.hasOwnProperty("msg")) {
|
|
1824
|
-
d.msg = m.msg;
|
|
1825
|
-
}
|
|
1826
|
-
return d;
|
|
1827
|
-
};
|
|
1828
|
-
|
|
1829
|
-
/**
|
|
1830
|
-
* Converts this ErrorResponse to JSON.
|
|
1831
|
-
* @function toJSON
|
|
1832
|
-
* @memberof ErrorResponse
|
|
1833
|
-
* @instance
|
|
1834
|
-
* @returns {Object.<string,*>} JSON object
|
|
1835
|
-
*/
|
|
1836
|
-
ErrorResponse.prototype.toJSON = function toJSON() {
|
|
1837
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
1838
|
-
};
|
|
1839
|
-
|
|
1840
|
-
return ErrorResponse;
|
|
1841
|
-
})();
|
|
1842
|
-
|
|
1843
|
-
export const StreamInfo = $root.StreamInfo = (() => {
|
|
1844
|
-
|
|
1845
|
-
/**
|
|
1846
|
-
* Properties of a StreamInfo.
|
|
1847
|
-
* @exports IStreamInfo
|
|
1848
|
-
* @interface IStreamInfo
|
|
1849
|
-
* @property {Uint8Array} peer StreamInfo peer
|
|
1850
|
-
* @property {Uint8Array} addr StreamInfo addr
|
|
1851
|
-
* @property {string} proto StreamInfo proto
|
|
1852
|
-
*/
|
|
1853
|
-
|
|
1854
|
-
/**
|
|
1855
|
-
* Constructs a new StreamInfo.
|
|
1856
|
-
* @exports StreamInfo
|
|
1857
|
-
* @classdesc Represents a StreamInfo.
|
|
1858
|
-
* @implements IStreamInfo
|
|
1859
|
-
* @constructor
|
|
1860
|
-
* @param {IStreamInfo=} [p] Properties to set
|
|
1861
|
-
*/
|
|
1862
|
-
function StreamInfo(p) {
|
|
1863
|
-
if (p)
|
|
1864
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
1865
|
-
if (p[ks[i]] != null)
|
|
1866
|
-
this[ks[i]] = p[ks[i]];
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
/**
|
|
1870
|
-
* StreamInfo peer.
|
|
1871
|
-
* @member {Uint8Array} peer
|
|
1872
|
-
* @memberof StreamInfo
|
|
1873
|
-
* @instance
|
|
1874
|
-
*/
|
|
1875
|
-
StreamInfo.prototype.peer = $util.newBuffer([]);
|
|
1876
|
-
|
|
1877
|
-
/**
|
|
1878
|
-
* StreamInfo addr.
|
|
1879
|
-
* @member {Uint8Array} addr
|
|
1880
|
-
* @memberof StreamInfo
|
|
1881
|
-
* @instance
|
|
1882
|
-
*/
|
|
1883
|
-
StreamInfo.prototype.addr = $util.newBuffer([]);
|
|
1884
|
-
|
|
1885
|
-
/**
|
|
1886
|
-
* StreamInfo proto.
|
|
1887
|
-
* @member {string} proto
|
|
1888
|
-
* @memberof StreamInfo
|
|
1889
|
-
* @instance
|
|
1890
|
-
*/
|
|
1891
|
-
StreamInfo.prototype.proto = "";
|
|
1892
|
-
|
|
1893
|
-
/**
|
|
1894
|
-
* Encodes the specified StreamInfo message. Does not implicitly {@link StreamInfo.verify|verify} messages.
|
|
1895
|
-
* @function encode
|
|
1896
|
-
* @memberof StreamInfo
|
|
1897
|
-
* @static
|
|
1898
|
-
* @param {IStreamInfo} m StreamInfo message or plain object to encode
|
|
1899
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
1900
|
-
* @returns {$protobuf.Writer} Writer
|
|
1901
|
-
*/
|
|
1902
|
-
StreamInfo.encode = function encode(m, w) {
|
|
1903
|
-
if (!w)
|
|
1904
|
-
w = $Writer.create();
|
|
1905
|
-
w.uint32(10).bytes(m.peer);
|
|
1906
|
-
w.uint32(18).bytes(m.addr);
|
|
1907
|
-
w.uint32(26).string(m.proto);
|
|
1908
|
-
return w;
|
|
1909
|
-
};
|
|
1910
|
-
|
|
1911
|
-
/**
|
|
1912
|
-
* Decodes a StreamInfo message from the specified reader or buffer.
|
|
1913
|
-
* @function decode
|
|
1914
|
-
* @memberof StreamInfo
|
|
1915
|
-
* @static
|
|
1916
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
1917
|
-
* @param {number} [l] Message length if known beforehand
|
|
1918
|
-
* @returns {StreamInfo} StreamInfo
|
|
1919
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1920
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1921
|
-
*/
|
|
1922
|
-
StreamInfo.decode = function decode(r, l) {
|
|
1923
|
-
if (!(r instanceof $Reader))
|
|
1924
|
-
r = $Reader.create(r);
|
|
1925
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.StreamInfo();
|
|
1926
|
-
while (r.pos < c) {
|
|
1927
|
-
var t = r.uint32();
|
|
1928
|
-
switch (t >>> 3) {
|
|
1929
|
-
case 1:
|
|
1930
|
-
m.peer = r.bytes();
|
|
1931
|
-
break;
|
|
1932
|
-
case 2:
|
|
1933
|
-
m.addr = r.bytes();
|
|
1934
|
-
break;
|
|
1935
|
-
case 3:
|
|
1936
|
-
m.proto = r.string();
|
|
1937
|
-
break;
|
|
1938
|
-
default:
|
|
1939
|
-
r.skipType(t & 7);
|
|
1940
|
-
break;
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
if (!m.hasOwnProperty("peer"))
|
|
1944
|
-
throw $util.ProtocolError("missing required 'peer'", { instance: m });
|
|
1945
|
-
if (!m.hasOwnProperty("addr"))
|
|
1946
|
-
throw $util.ProtocolError("missing required 'addr'", { instance: m });
|
|
1947
|
-
if (!m.hasOwnProperty("proto"))
|
|
1948
|
-
throw $util.ProtocolError("missing required 'proto'", { instance: m });
|
|
1949
|
-
return m;
|
|
1950
|
-
};
|
|
1951
|
-
|
|
1952
|
-
/**
|
|
1953
|
-
* Creates a StreamInfo message from a plain object. Also converts values to their respective internal types.
|
|
1954
|
-
* @function fromObject
|
|
1955
|
-
* @memberof StreamInfo
|
|
1956
|
-
* @static
|
|
1957
|
-
* @param {Object.<string,*>} d Plain object
|
|
1958
|
-
* @returns {StreamInfo} StreamInfo
|
|
1959
|
-
*/
|
|
1960
|
-
StreamInfo.fromObject = function fromObject(d) {
|
|
1961
|
-
if (d instanceof $root.StreamInfo)
|
|
1962
|
-
return d;
|
|
1963
|
-
var m = new $root.StreamInfo();
|
|
1964
|
-
if (d.peer != null) {
|
|
1965
|
-
if (typeof d.peer === "string")
|
|
1966
|
-
$util.base64.decode(d.peer, m.peer = $util.newBuffer($util.base64.length(d.peer)), 0);
|
|
1967
|
-
else if (d.peer.length)
|
|
1968
|
-
m.peer = d.peer;
|
|
1969
|
-
}
|
|
1970
|
-
if (d.addr != null) {
|
|
1971
|
-
if (typeof d.addr === "string")
|
|
1972
|
-
$util.base64.decode(d.addr, m.addr = $util.newBuffer($util.base64.length(d.addr)), 0);
|
|
1973
|
-
else if (d.addr.length)
|
|
1974
|
-
m.addr = d.addr;
|
|
1975
|
-
}
|
|
1976
|
-
if (d.proto != null) {
|
|
1977
|
-
m.proto = String(d.proto);
|
|
1978
|
-
}
|
|
1979
|
-
return m;
|
|
1980
|
-
};
|
|
1981
|
-
|
|
1982
|
-
/**
|
|
1983
|
-
* Creates a plain object from a StreamInfo message. Also converts values to other types if specified.
|
|
1984
|
-
* @function toObject
|
|
1985
|
-
* @memberof StreamInfo
|
|
1986
|
-
* @static
|
|
1987
|
-
* @param {StreamInfo} m StreamInfo
|
|
1988
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
1989
|
-
* @returns {Object.<string,*>} Plain object
|
|
1990
|
-
*/
|
|
1991
|
-
StreamInfo.toObject = function toObject(m, o) {
|
|
1992
|
-
if (!o)
|
|
1993
|
-
o = {};
|
|
1994
|
-
var d = {};
|
|
1995
|
-
if (o.defaults) {
|
|
1996
|
-
if (o.bytes === String)
|
|
1997
|
-
d.peer = "";
|
|
1998
|
-
else {
|
|
1999
|
-
d.peer = [];
|
|
2000
|
-
if (o.bytes !== Array)
|
|
2001
|
-
d.peer = $util.newBuffer(d.peer);
|
|
2002
|
-
}
|
|
2003
|
-
if (o.bytes === String)
|
|
2004
|
-
d.addr = "";
|
|
2005
|
-
else {
|
|
2006
|
-
d.addr = [];
|
|
2007
|
-
if (o.bytes !== Array)
|
|
2008
|
-
d.addr = $util.newBuffer(d.addr);
|
|
2009
|
-
}
|
|
2010
|
-
d.proto = "";
|
|
2011
|
-
}
|
|
2012
|
-
if (m.peer != null && m.hasOwnProperty("peer")) {
|
|
2013
|
-
d.peer = o.bytes === String ? $util.base64.encode(m.peer, 0, m.peer.length) : o.bytes === Array ? Array.prototype.slice.call(m.peer) : m.peer;
|
|
2014
|
-
}
|
|
2015
|
-
if (m.addr != null && m.hasOwnProperty("addr")) {
|
|
2016
|
-
d.addr = o.bytes === String ? $util.base64.encode(m.addr, 0, m.addr.length) : o.bytes === Array ? Array.prototype.slice.call(m.addr) : m.addr;
|
|
2017
|
-
}
|
|
2018
|
-
if (m.proto != null && m.hasOwnProperty("proto")) {
|
|
2019
|
-
d.proto = m.proto;
|
|
2020
|
-
}
|
|
2021
|
-
return d;
|
|
2022
|
-
};
|
|
2023
|
-
|
|
2024
|
-
/**
|
|
2025
|
-
* Converts this StreamInfo to JSON.
|
|
2026
|
-
* @function toJSON
|
|
2027
|
-
* @memberof StreamInfo
|
|
2028
|
-
* @instance
|
|
2029
|
-
* @returns {Object.<string,*>} JSON object
|
|
2030
|
-
*/
|
|
2031
|
-
StreamInfo.prototype.toJSON = function toJSON() {
|
|
2032
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
2033
|
-
};
|
|
2034
|
-
|
|
2035
|
-
return StreamInfo;
|
|
2036
|
-
})();
|
|
2037
|
-
|
|
2038
|
-
export const DHTRequest = $root.DHTRequest = (() => {
|
|
2039
|
-
|
|
2040
|
-
/**
|
|
2041
|
-
* Properties of a DHTRequest.
|
|
2042
|
-
* @exports IDHTRequest
|
|
2043
|
-
* @interface IDHTRequest
|
|
2044
|
-
* @property {DHTRequest.Type} type DHTRequest type
|
|
2045
|
-
* @property {Uint8Array|null} [peer] DHTRequest peer
|
|
2046
|
-
* @property {Uint8Array|null} [cid] DHTRequest cid
|
|
2047
|
-
* @property {Uint8Array|null} [key] DHTRequest key
|
|
2048
|
-
* @property {Uint8Array|null} [value] DHTRequest value
|
|
2049
|
-
* @property {number|null} [count] DHTRequest count
|
|
2050
|
-
* @property {number|null} [timeout] DHTRequest timeout
|
|
2051
|
-
*/
|
|
2052
|
-
|
|
2053
|
-
/**
|
|
2054
|
-
* Constructs a new DHTRequest.
|
|
2055
|
-
* @exports DHTRequest
|
|
2056
|
-
* @classdesc Represents a DHTRequest.
|
|
2057
|
-
* @implements IDHTRequest
|
|
2058
|
-
* @constructor
|
|
2059
|
-
* @param {IDHTRequest=} [p] Properties to set
|
|
2060
|
-
*/
|
|
2061
|
-
function DHTRequest(p) {
|
|
2062
|
-
if (p)
|
|
2063
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
2064
|
-
if (p[ks[i]] != null)
|
|
2065
|
-
this[ks[i]] = p[ks[i]];
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
/**
|
|
2069
|
-
* DHTRequest type.
|
|
2070
|
-
* @member {DHTRequest.Type} type
|
|
2071
|
-
* @memberof DHTRequest
|
|
2072
|
-
* @instance
|
|
2073
|
-
*/
|
|
2074
|
-
DHTRequest.prototype.type = 0;
|
|
2075
|
-
|
|
2076
|
-
/**
|
|
2077
|
-
* DHTRequest peer.
|
|
2078
|
-
* @member {Uint8Array|null|undefined} peer
|
|
2079
|
-
* @memberof DHTRequest
|
|
2080
|
-
* @instance
|
|
2081
|
-
*/
|
|
2082
|
-
DHTRequest.prototype.peer = null;
|
|
2083
|
-
|
|
2084
|
-
/**
|
|
2085
|
-
* DHTRequest cid.
|
|
2086
|
-
* @member {Uint8Array|null|undefined} cid
|
|
2087
|
-
* @memberof DHTRequest
|
|
2088
|
-
* @instance
|
|
2089
|
-
*/
|
|
2090
|
-
DHTRequest.prototype.cid = null;
|
|
2091
|
-
|
|
2092
|
-
/**
|
|
2093
|
-
* DHTRequest key.
|
|
2094
|
-
* @member {Uint8Array|null|undefined} key
|
|
2095
|
-
* @memberof DHTRequest
|
|
2096
|
-
* @instance
|
|
2097
|
-
*/
|
|
2098
|
-
DHTRequest.prototype.key = null;
|
|
2099
|
-
|
|
2100
|
-
/**
|
|
2101
|
-
* DHTRequest value.
|
|
2102
|
-
* @member {Uint8Array|null|undefined} value
|
|
2103
|
-
* @memberof DHTRequest
|
|
2104
|
-
* @instance
|
|
2105
|
-
*/
|
|
2106
|
-
DHTRequest.prototype.value = null;
|
|
2107
|
-
|
|
2108
|
-
/**
|
|
2109
|
-
* DHTRequest count.
|
|
2110
|
-
* @member {number|null|undefined} count
|
|
2111
|
-
* @memberof DHTRequest
|
|
2112
|
-
* @instance
|
|
2113
|
-
*/
|
|
2114
|
-
DHTRequest.prototype.count = null;
|
|
2115
|
-
|
|
2116
|
-
/**
|
|
2117
|
-
* DHTRequest timeout.
|
|
2118
|
-
* @member {number|null|undefined} timeout
|
|
2119
|
-
* @memberof DHTRequest
|
|
2120
|
-
* @instance
|
|
2121
|
-
*/
|
|
2122
|
-
DHTRequest.prototype.timeout = null;
|
|
2123
|
-
|
|
2124
|
-
// OneOf field names bound to virtual getters and setters
|
|
2125
|
-
let $oneOfFields;
|
|
2126
|
-
|
|
2127
|
-
/**
|
|
2128
|
-
* DHTRequest _peer.
|
|
2129
|
-
* @member {"peer"|undefined} _peer
|
|
2130
|
-
* @memberof DHTRequest
|
|
2131
|
-
* @instance
|
|
2132
|
-
*/
|
|
2133
|
-
Object.defineProperty(DHTRequest.prototype, "_peer", {
|
|
2134
|
-
get: $util.oneOfGetter($oneOfFields = ["peer"]),
|
|
2135
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2136
|
-
});
|
|
2137
|
-
|
|
2138
|
-
/**
|
|
2139
|
-
* DHTRequest _cid.
|
|
2140
|
-
* @member {"cid"|undefined} _cid
|
|
2141
|
-
* @memberof DHTRequest
|
|
2142
|
-
* @instance
|
|
2143
|
-
*/
|
|
2144
|
-
Object.defineProperty(DHTRequest.prototype, "_cid", {
|
|
2145
|
-
get: $util.oneOfGetter($oneOfFields = ["cid"]),
|
|
2146
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2147
|
-
});
|
|
2148
|
-
|
|
2149
|
-
/**
|
|
2150
|
-
* DHTRequest _key.
|
|
2151
|
-
* @member {"key"|undefined} _key
|
|
2152
|
-
* @memberof DHTRequest
|
|
2153
|
-
* @instance
|
|
2154
|
-
*/
|
|
2155
|
-
Object.defineProperty(DHTRequest.prototype, "_key", {
|
|
2156
|
-
get: $util.oneOfGetter($oneOfFields = ["key"]),
|
|
2157
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2158
|
-
});
|
|
2159
|
-
|
|
2160
|
-
/**
|
|
2161
|
-
* DHTRequest _value.
|
|
2162
|
-
* @member {"value"|undefined} _value
|
|
2163
|
-
* @memberof DHTRequest
|
|
2164
|
-
* @instance
|
|
2165
|
-
*/
|
|
2166
|
-
Object.defineProperty(DHTRequest.prototype, "_value", {
|
|
2167
|
-
get: $util.oneOfGetter($oneOfFields = ["value"]),
|
|
2168
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2169
|
-
});
|
|
2170
|
-
|
|
2171
|
-
/**
|
|
2172
|
-
* DHTRequest _count.
|
|
2173
|
-
* @member {"count"|undefined} _count
|
|
2174
|
-
* @memberof DHTRequest
|
|
2175
|
-
* @instance
|
|
2176
|
-
*/
|
|
2177
|
-
Object.defineProperty(DHTRequest.prototype, "_count", {
|
|
2178
|
-
get: $util.oneOfGetter($oneOfFields = ["count"]),
|
|
2179
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2180
|
-
});
|
|
2181
|
-
|
|
2182
|
-
/**
|
|
2183
|
-
* DHTRequest _timeout.
|
|
2184
|
-
* @member {"timeout"|undefined} _timeout
|
|
2185
|
-
* @memberof DHTRequest
|
|
2186
|
-
* @instance
|
|
2187
|
-
*/
|
|
2188
|
-
Object.defineProperty(DHTRequest.prototype, "_timeout", {
|
|
2189
|
-
get: $util.oneOfGetter($oneOfFields = ["timeout"]),
|
|
2190
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2191
|
-
});
|
|
2192
|
-
|
|
2193
|
-
/**
|
|
2194
|
-
* Encodes the specified DHTRequest message. Does not implicitly {@link DHTRequest.verify|verify} messages.
|
|
2195
|
-
* @function encode
|
|
2196
|
-
* @memberof DHTRequest
|
|
2197
|
-
* @static
|
|
2198
|
-
* @param {IDHTRequest} m DHTRequest message or plain object to encode
|
|
2199
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
2200
|
-
* @returns {$protobuf.Writer} Writer
|
|
2201
|
-
*/
|
|
2202
|
-
DHTRequest.encode = function encode(m, w) {
|
|
2203
|
-
if (!w)
|
|
2204
|
-
w = $Writer.create();
|
|
2205
|
-
w.uint32(8).int32(m.type);
|
|
2206
|
-
if (m.peer != null && Object.hasOwnProperty.call(m, "peer"))
|
|
2207
|
-
w.uint32(18).bytes(m.peer);
|
|
2208
|
-
if (m.cid != null && Object.hasOwnProperty.call(m, "cid"))
|
|
2209
|
-
w.uint32(26).bytes(m.cid);
|
|
2210
|
-
if (m.key != null && Object.hasOwnProperty.call(m, "key"))
|
|
2211
|
-
w.uint32(34).bytes(m.key);
|
|
2212
|
-
if (m.value != null && Object.hasOwnProperty.call(m, "value"))
|
|
2213
|
-
w.uint32(42).bytes(m.value);
|
|
2214
|
-
if (m.count != null && Object.hasOwnProperty.call(m, "count"))
|
|
2215
|
-
w.uint32(48).int32(m.count);
|
|
2216
|
-
if (m.timeout != null && Object.hasOwnProperty.call(m, "timeout"))
|
|
2217
|
-
w.uint32(56).int64(m.timeout);
|
|
2218
|
-
return w;
|
|
2219
|
-
};
|
|
2220
|
-
|
|
2221
|
-
/**
|
|
2222
|
-
* Decodes a DHTRequest message from the specified reader or buffer.
|
|
2223
|
-
* @function decode
|
|
2224
|
-
* @memberof DHTRequest
|
|
2225
|
-
* @static
|
|
2226
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
2227
|
-
* @param {number} [l] Message length if known beforehand
|
|
2228
|
-
* @returns {DHTRequest} DHTRequest
|
|
2229
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
2230
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
2231
|
-
*/
|
|
2232
|
-
DHTRequest.decode = function decode(r, l) {
|
|
2233
|
-
if (!(r instanceof $Reader))
|
|
2234
|
-
r = $Reader.create(r);
|
|
2235
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.DHTRequest();
|
|
2236
|
-
while (r.pos < c) {
|
|
2237
|
-
var t = r.uint32();
|
|
2238
|
-
switch (t >>> 3) {
|
|
2239
|
-
case 1:
|
|
2240
|
-
m.type = r.int32();
|
|
2241
|
-
break;
|
|
2242
|
-
case 2:
|
|
2243
|
-
m.peer = r.bytes();
|
|
2244
|
-
break;
|
|
2245
|
-
case 3:
|
|
2246
|
-
m.cid = r.bytes();
|
|
2247
|
-
break;
|
|
2248
|
-
case 4:
|
|
2249
|
-
m.key = r.bytes();
|
|
2250
|
-
break;
|
|
2251
|
-
case 5:
|
|
2252
|
-
m.value = r.bytes();
|
|
2253
|
-
break;
|
|
2254
|
-
case 6:
|
|
2255
|
-
m.count = r.int32();
|
|
2256
|
-
break;
|
|
2257
|
-
case 7:
|
|
2258
|
-
m.timeout = r.int64();
|
|
2259
|
-
break;
|
|
2260
|
-
default:
|
|
2261
|
-
r.skipType(t & 7);
|
|
2262
|
-
break;
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
if (!m.hasOwnProperty("type"))
|
|
2266
|
-
throw $util.ProtocolError("missing required 'type'", { instance: m });
|
|
2267
|
-
return m;
|
|
2268
|
-
};
|
|
2269
|
-
|
|
2270
|
-
/**
|
|
2271
|
-
* Creates a DHTRequest message from a plain object. Also converts values to their respective internal types.
|
|
2272
|
-
* @function fromObject
|
|
2273
|
-
* @memberof DHTRequest
|
|
2274
|
-
* @static
|
|
2275
|
-
* @param {Object.<string,*>} d Plain object
|
|
2276
|
-
* @returns {DHTRequest} DHTRequest
|
|
2277
|
-
*/
|
|
2278
|
-
DHTRequest.fromObject = function fromObject(d) {
|
|
2279
|
-
if (d instanceof $root.DHTRequest)
|
|
2280
|
-
return d;
|
|
2281
|
-
var m = new $root.DHTRequest();
|
|
2282
|
-
switch (d.type) {
|
|
2283
|
-
case "FIND_PEER":
|
|
2284
|
-
case 0:
|
|
2285
|
-
m.type = 0;
|
|
2286
|
-
break;
|
|
2287
|
-
case "FIND_PEERS_CONNECTED_TO_PEER":
|
|
2288
|
-
case 1:
|
|
2289
|
-
m.type = 1;
|
|
2290
|
-
break;
|
|
2291
|
-
case "FIND_PROVIDERS":
|
|
2292
|
-
case 2:
|
|
2293
|
-
m.type = 2;
|
|
2294
|
-
break;
|
|
2295
|
-
case "GET_CLOSEST_PEERS":
|
|
2296
|
-
case 3:
|
|
2297
|
-
m.type = 3;
|
|
2298
|
-
break;
|
|
2299
|
-
case "GET_PUBLIC_KEY":
|
|
2300
|
-
case 4:
|
|
2301
|
-
m.type = 4;
|
|
2302
|
-
break;
|
|
2303
|
-
case "GET_VALUE":
|
|
2304
|
-
case 5:
|
|
2305
|
-
m.type = 5;
|
|
2306
|
-
break;
|
|
2307
|
-
case "SEARCH_VALUE":
|
|
2308
|
-
case 6:
|
|
2309
|
-
m.type = 6;
|
|
2310
|
-
break;
|
|
2311
|
-
case "PUT_VALUE":
|
|
2312
|
-
case 7:
|
|
2313
|
-
m.type = 7;
|
|
2314
|
-
break;
|
|
2315
|
-
case "PROVIDE":
|
|
2316
|
-
case 8:
|
|
2317
|
-
m.type = 8;
|
|
2318
|
-
break;
|
|
2319
|
-
}
|
|
2320
|
-
if (d.peer != null) {
|
|
2321
|
-
if (typeof d.peer === "string")
|
|
2322
|
-
$util.base64.decode(d.peer, m.peer = $util.newBuffer($util.base64.length(d.peer)), 0);
|
|
2323
|
-
else if (d.peer.length)
|
|
2324
|
-
m.peer = d.peer;
|
|
2325
|
-
}
|
|
2326
|
-
if (d.cid != null) {
|
|
2327
|
-
if (typeof d.cid === "string")
|
|
2328
|
-
$util.base64.decode(d.cid, m.cid = $util.newBuffer($util.base64.length(d.cid)), 0);
|
|
2329
|
-
else if (d.cid.length)
|
|
2330
|
-
m.cid = d.cid;
|
|
2331
|
-
}
|
|
2332
|
-
if (d.key != null) {
|
|
2333
|
-
if (typeof d.key === "string")
|
|
2334
|
-
$util.base64.decode(d.key, m.key = $util.newBuffer($util.base64.length(d.key)), 0);
|
|
2335
|
-
else if (d.key.length)
|
|
2336
|
-
m.key = d.key;
|
|
2337
|
-
}
|
|
2338
|
-
if (d.value != null) {
|
|
2339
|
-
if (typeof d.value === "string")
|
|
2340
|
-
$util.base64.decode(d.value, m.value = $util.newBuffer($util.base64.length(d.value)), 0);
|
|
2341
|
-
else if (d.value.length)
|
|
2342
|
-
m.value = d.value;
|
|
2343
|
-
}
|
|
2344
|
-
if (d.count != null) {
|
|
2345
|
-
m.count = d.count | 0;
|
|
2346
|
-
}
|
|
2347
|
-
if (d.timeout != null) {
|
|
2348
|
-
if ($util.Long)
|
|
2349
|
-
(m.timeout = $util.Long.fromValue(d.timeout)).unsigned = false;
|
|
2350
|
-
else if (typeof d.timeout === "string")
|
|
2351
|
-
m.timeout = parseInt(d.timeout, 10);
|
|
2352
|
-
else if (typeof d.timeout === "number")
|
|
2353
|
-
m.timeout = d.timeout;
|
|
2354
|
-
else if (typeof d.timeout === "object")
|
|
2355
|
-
m.timeout = new $util.LongBits(d.timeout.low >>> 0, d.timeout.high >>> 0).toNumber();
|
|
2356
|
-
}
|
|
2357
|
-
return m;
|
|
2358
|
-
};
|
|
2359
|
-
|
|
2360
|
-
/**
|
|
2361
|
-
* Creates a plain object from a DHTRequest message. Also converts values to other types if specified.
|
|
2362
|
-
* @function toObject
|
|
2363
|
-
* @memberof DHTRequest
|
|
2364
|
-
* @static
|
|
2365
|
-
* @param {DHTRequest} m DHTRequest
|
|
2366
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
2367
|
-
* @returns {Object.<string,*>} Plain object
|
|
2368
|
-
*/
|
|
2369
|
-
DHTRequest.toObject = function toObject(m, o) {
|
|
2370
|
-
if (!o)
|
|
2371
|
-
o = {};
|
|
2372
|
-
var d = {};
|
|
2373
|
-
if (o.defaults) {
|
|
2374
|
-
d.type = o.enums === String ? "FIND_PEER" : 0;
|
|
2375
|
-
}
|
|
2376
|
-
if (m.type != null && m.hasOwnProperty("type")) {
|
|
2377
|
-
d.type = o.enums === String ? $root.DHTRequest.Type[m.type] : m.type;
|
|
2378
|
-
}
|
|
2379
|
-
if (m.peer != null && m.hasOwnProperty("peer")) {
|
|
2380
|
-
d.peer = o.bytes === String ? $util.base64.encode(m.peer, 0, m.peer.length) : o.bytes === Array ? Array.prototype.slice.call(m.peer) : m.peer;
|
|
2381
|
-
if (o.oneofs)
|
|
2382
|
-
d._peer = "peer";
|
|
2383
|
-
}
|
|
2384
|
-
if (m.cid != null && m.hasOwnProperty("cid")) {
|
|
2385
|
-
d.cid = o.bytes === String ? $util.base64.encode(m.cid, 0, m.cid.length) : o.bytes === Array ? Array.prototype.slice.call(m.cid) : m.cid;
|
|
2386
|
-
if (o.oneofs)
|
|
2387
|
-
d._cid = "cid";
|
|
2388
|
-
}
|
|
2389
|
-
if (m.key != null && m.hasOwnProperty("key")) {
|
|
2390
|
-
d.key = o.bytes === String ? $util.base64.encode(m.key, 0, m.key.length) : o.bytes === Array ? Array.prototype.slice.call(m.key) : m.key;
|
|
2391
|
-
if (o.oneofs)
|
|
2392
|
-
d._key = "key";
|
|
2393
|
-
}
|
|
2394
|
-
if (m.value != null && m.hasOwnProperty("value")) {
|
|
2395
|
-
d.value = o.bytes === String ? $util.base64.encode(m.value, 0, m.value.length) : o.bytes === Array ? Array.prototype.slice.call(m.value) : m.value;
|
|
2396
|
-
if (o.oneofs)
|
|
2397
|
-
d._value = "value";
|
|
2398
|
-
}
|
|
2399
|
-
if (m.count != null && m.hasOwnProperty("count")) {
|
|
2400
|
-
d.count = m.count;
|
|
2401
|
-
if (o.oneofs)
|
|
2402
|
-
d._count = "count";
|
|
2403
|
-
}
|
|
2404
|
-
if (m.timeout != null && m.hasOwnProperty("timeout")) {
|
|
2405
|
-
if (typeof m.timeout === "number")
|
|
2406
|
-
d.timeout = o.longs === String ? String(m.timeout) : m.timeout;
|
|
2407
|
-
else
|
|
2408
|
-
d.timeout = o.longs === String ? $util.Long.prototype.toString.call(m.timeout) : o.longs === Number ? new $util.LongBits(m.timeout.low >>> 0, m.timeout.high >>> 0).toNumber() : m.timeout;
|
|
2409
|
-
if (o.oneofs)
|
|
2410
|
-
d._timeout = "timeout";
|
|
2411
|
-
}
|
|
2412
|
-
return d;
|
|
2413
|
-
};
|
|
2414
|
-
|
|
2415
|
-
/**
|
|
2416
|
-
* Converts this DHTRequest to JSON.
|
|
2417
|
-
* @function toJSON
|
|
2418
|
-
* @memberof DHTRequest
|
|
2419
|
-
* @instance
|
|
2420
|
-
* @returns {Object.<string,*>} JSON object
|
|
2421
|
-
*/
|
|
2422
|
-
DHTRequest.prototype.toJSON = function toJSON() {
|
|
2423
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
2424
|
-
};
|
|
2425
|
-
|
|
2426
|
-
/**
|
|
2427
|
-
* Type enum.
|
|
2428
|
-
* @name DHTRequest.Type
|
|
2429
|
-
* @enum {number}
|
|
2430
|
-
* @property {number} FIND_PEER=0 FIND_PEER value
|
|
2431
|
-
* @property {number} FIND_PEERS_CONNECTED_TO_PEER=1 FIND_PEERS_CONNECTED_TO_PEER value
|
|
2432
|
-
* @property {number} FIND_PROVIDERS=2 FIND_PROVIDERS value
|
|
2433
|
-
* @property {number} GET_CLOSEST_PEERS=3 GET_CLOSEST_PEERS value
|
|
2434
|
-
* @property {number} GET_PUBLIC_KEY=4 GET_PUBLIC_KEY value
|
|
2435
|
-
* @property {number} GET_VALUE=5 GET_VALUE value
|
|
2436
|
-
* @property {number} SEARCH_VALUE=6 SEARCH_VALUE value
|
|
2437
|
-
* @property {number} PUT_VALUE=7 PUT_VALUE value
|
|
2438
|
-
* @property {number} PROVIDE=8 PROVIDE value
|
|
2439
|
-
*/
|
|
2440
|
-
DHTRequest.Type = (function() {
|
|
2441
|
-
const valuesById = {}, values = Object.create(valuesById);
|
|
2442
|
-
values[valuesById[0] = "FIND_PEER"] = 0;
|
|
2443
|
-
values[valuesById[1] = "FIND_PEERS_CONNECTED_TO_PEER"] = 1;
|
|
2444
|
-
values[valuesById[2] = "FIND_PROVIDERS"] = 2;
|
|
2445
|
-
values[valuesById[3] = "GET_CLOSEST_PEERS"] = 3;
|
|
2446
|
-
values[valuesById[4] = "GET_PUBLIC_KEY"] = 4;
|
|
2447
|
-
values[valuesById[5] = "GET_VALUE"] = 5;
|
|
2448
|
-
values[valuesById[6] = "SEARCH_VALUE"] = 6;
|
|
2449
|
-
values[valuesById[7] = "PUT_VALUE"] = 7;
|
|
2450
|
-
values[valuesById[8] = "PROVIDE"] = 8;
|
|
2451
|
-
return values;
|
|
2452
|
-
})();
|
|
2453
|
-
|
|
2454
|
-
return DHTRequest;
|
|
2455
|
-
})();
|
|
2456
|
-
|
|
2457
|
-
export const DHTResponse = $root.DHTResponse = (() => {
|
|
2458
|
-
|
|
2459
|
-
/**
|
|
2460
|
-
* Properties of a DHTResponse.
|
|
2461
|
-
* @exports IDHTResponse
|
|
2462
|
-
* @interface IDHTResponse
|
|
2463
|
-
* @property {DHTResponse.Type} type DHTResponse type
|
|
2464
|
-
* @property {IPeerInfo|null} [peer] DHTResponse peer
|
|
2465
|
-
* @property {Uint8Array|null} [value] DHTResponse value
|
|
2466
|
-
*/
|
|
2467
|
-
|
|
2468
|
-
/**
|
|
2469
|
-
* Constructs a new DHTResponse.
|
|
2470
|
-
* @exports DHTResponse
|
|
2471
|
-
* @classdesc Represents a DHTResponse.
|
|
2472
|
-
* @implements IDHTResponse
|
|
2473
|
-
* @constructor
|
|
2474
|
-
* @param {IDHTResponse=} [p] Properties to set
|
|
2475
|
-
*/
|
|
2476
|
-
function DHTResponse(p) {
|
|
2477
|
-
if (p)
|
|
2478
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
2479
|
-
if (p[ks[i]] != null)
|
|
2480
|
-
this[ks[i]] = p[ks[i]];
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
/**
|
|
2484
|
-
* DHTResponse type.
|
|
2485
|
-
* @member {DHTResponse.Type} type
|
|
2486
|
-
* @memberof DHTResponse
|
|
2487
|
-
* @instance
|
|
2488
|
-
*/
|
|
2489
|
-
DHTResponse.prototype.type = 0;
|
|
2490
|
-
|
|
2491
|
-
/**
|
|
2492
|
-
* DHTResponse peer.
|
|
2493
|
-
* @member {IPeerInfo|null|undefined} peer
|
|
2494
|
-
* @memberof DHTResponse
|
|
2495
|
-
* @instance
|
|
2496
|
-
*/
|
|
2497
|
-
DHTResponse.prototype.peer = null;
|
|
2498
|
-
|
|
2499
|
-
/**
|
|
2500
|
-
* DHTResponse value.
|
|
2501
|
-
* @member {Uint8Array|null|undefined} value
|
|
2502
|
-
* @memberof DHTResponse
|
|
2503
|
-
* @instance
|
|
2504
|
-
*/
|
|
2505
|
-
DHTResponse.prototype.value = null;
|
|
2506
|
-
|
|
2507
|
-
// OneOf field names bound to virtual getters and setters
|
|
2508
|
-
let $oneOfFields;
|
|
2509
|
-
|
|
2510
|
-
/**
|
|
2511
|
-
* DHTResponse _peer.
|
|
2512
|
-
* @member {"peer"|undefined} _peer
|
|
2513
|
-
* @memberof DHTResponse
|
|
2514
|
-
* @instance
|
|
2515
|
-
*/
|
|
2516
|
-
Object.defineProperty(DHTResponse.prototype, "_peer", {
|
|
2517
|
-
get: $util.oneOfGetter($oneOfFields = ["peer"]),
|
|
2518
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2519
|
-
});
|
|
2520
|
-
|
|
2521
|
-
/**
|
|
2522
|
-
* DHTResponse _value.
|
|
2523
|
-
* @member {"value"|undefined} _value
|
|
2524
|
-
* @memberof DHTResponse
|
|
2525
|
-
* @instance
|
|
2526
|
-
*/
|
|
2527
|
-
Object.defineProperty(DHTResponse.prototype, "_value", {
|
|
2528
|
-
get: $util.oneOfGetter($oneOfFields = ["value"]),
|
|
2529
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2530
|
-
});
|
|
2531
|
-
|
|
2532
|
-
/**
|
|
2533
|
-
* Encodes the specified DHTResponse message. Does not implicitly {@link DHTResponse.verify|verify} messages.
|
|
2534
|
-
* @function encode
|
|
2535
|
-
* @memberof DHTResponse
|
|
2536
|
-
* @static
|
|
2537
|
-
* @param {IDHTResponse} m DHTResponse message or plain object to encode
|
|
2538
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
2539
|
-
* @returns {$protobuf.Writer} Writer
|
|
2540
|
-
*/
|
|
2541
|
-
DHTResponse.encode = function encode(m, w) {
|
|
2542
|
-
if (!w)
|
|
2543
|
-
w = $Writer.create();
|
|
2544
|
-
w.uint32(8).int32(m.type);
|
|
2545
|
-
if (m.peer != null && Object.hasOwnProperty.call(m, "peer"))
|
|
2546
|
-
$root.PeerInfo.encode(m.peer, w.uint32(18).fork()).ldelim();
|
|
2547
|
-
if (m.value != null && Object.hasOwnProperty.call(m, "value"))
|
|
2548
|
-
w.uint32(26).bytes(m.value);
|
|
2549
|
-
return w;
|
|
2550
|
-
};
|
|
2551
|
-
|
|
2552
|
-
/**
|
|
2553
|
-
* Decodes a DHTResponse message from the specified reader or buffer.
|
|
2554
|
-
* @function decode
|
|
2555
|
-
* @memberof DHTResponse
|
|
2556
|
-
* @static
|
|
2557
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
2558
|
-
* @param {number} [l] Message length if known beforehand
|
|
2559
|
-
* @returns {DHTResponse} DHTResponse
|
|
2560
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
2561
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
2562
|
-
*/
|
|
2563
|
-
DHTResponse.decode = function decode(r, l) {
|
|
2564
|
-
if (!(r instanceof $Reader))
|
|
2565
|
-
r = $Reader.create(r);
|
|
2566
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.DHTResponse();
|
|
2567
|
-
while (r.pos < c) {
|
|
2568
|
-
var t = r.uint32();
|
|
2569
|
-
switch (t >>> 3) {
|
|
2570
|
-
case 1:
|
|
2571
|
-
m.type = r.int32();
|
|
2572
|
-
break;
|
|
2573
|
-
case 2:
|
|
2574
|
-
m.peer = $root.PeerInfo.decode(r, r.uint32());
|
|
2575
|
-
break;
|
|
2576
|
-
case 3:
|
|
2577
|
-
m.value = r.bytes();
|
|
2578
|
-
break;
|
|
2579
|
-
default:
|
|
2580
|
-
r.skipType(t & 7);
|
|
2581
|
-
break;
|
|
2582
|
-
}
|
|
2583
|
-
}
|
|
2584
|
-
if (!m.hasOwnProperty("type"))
|
|
2585
|
-
throw $util.ProtocolError("missing required 'type'", { instance: m });
|
|
2586
|
-
return m;
|
|
2587
|
-
};
|
|
2588
|
-
|
|
2589
|
-
/**
|
|
2590
|
-
* Creates a DHTResponse message from a plain object. Also converts values to their respective internal types.
|
|
2591
|
-
* @function fromObject
|
|
2592
|
-
* @memberof DHTResponse
|
|
2593
|
-
* @static
|
|
2594
|
-
* @param {Object.<string,*>} d Plain object
|
|
2595
|
-
* @returns {DHTResponse} DHTResponse
|
|
2596
|
-
*/
|
|
2597
|
-
DHTResponse.fromObject = function fromObject(d) {
|
|
2598
|
-
if (d instanceof $root.DHTResponse)
|
|
2599
|
-
return d;
|
|
2600
|
-
var m = new $root.DHTResponse();
|
|
2601
|
-
switch (d.type) {
|
|
2602
|
-
case "BEGIN":
|
|
2603
|
-
case 0:
|
|
2604
|
-
m.type = 0;
|
|
2605
|
-
break;
|
|
2606
|
-
case "VALUE":
|
|
2607
|
-
case 1:
|
|
2608
|
-
m.type = 1;
|
|
2609
|
-
break;
|
|
2610
|
-
case "END":
|
|
2611
|
-
case 2:
|
|
2612
|
-
m.type = 2;
|
|
2613
|
-
break;
|
|
2614
|
-
}
|
|
2615
|
-
if (d.peer != null) {
|
|
2616
|
-
if (typeof d.peer !== "object")
|
|
2617
|
-
throw TypeError(".DHTResponse.peer: object expected");
|
|
2618
|
-
m.peer = $root.PeerInfo.fromObject(d.peer);
|
|
2619
|
-
}
|
|
2620
|
-
if (d.value != null) {
|
|
2621
|
-
if (typeof d.value === "string")
|
|
2622
|
-
$util.base64.decode(d.value, m.value = $util.newBuffer($util.base64.length(d.value)), 0);
|
|
2623
|
-
else if (d.value.length)
|
|
2624
|
-
m.value = d.value;
|
|
2625
|
-
}
|
|
2626
|
-
return m;
|
|
2627
|
-
};
|
|
2628
|
-
|
|
2629
|
-
/**
|
|
2630
|
-
* Creates a plain object from a DHTResponse message. Also converts values to other types if specified.
|
|
2631
|
-
* @function toObject
|
|
2632
|
-
* @memberof DHTResponse
|
|
2633
|
-
* @static
|
|
2634
|
-
* @param {DHTResponse} m DHTResponse
|
|
2635
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
2636
|
-
* @returns {Object.<string,*>} Plain object
|
|
2637
|
-
*/
|
|
2638
|
-
DHTResponse.toObject = function toObject(m, o) {
|
|
2639
|
-
if (!o)
|
|
2640
|
-
o = {};
|
|
2641
|
-
var d = {};
|
|
2642
|
-
if (o.defaults) {
|
|
2643
|
-
d.type = o.enums === String ? "BEGIN" : 0;
|
|
2644
|
-
}
|
|
2645
|
-
if (m.type != null && m.hasOwnProperty("type")) {
|
|
2646
|
-
d.type = o.enums === String ? $root.DHTResponse.Type[m.type] : m.type;
|
|
2647
|
-
}
|
|
2648
|
-
if (m.peer != null && m.hasOwnProperty("peer")) {
|
|
2649
|
-
d.peer = $root.PeerInfo.toObject(m.peer, o);
|
|
2650
|
-
if (o.oneofs)
|
|
2651
|
-
d._peer = "peer";
|
|
2652
|
-
}
|
|
2653
|
-
if (m.value != null && m.hasOwnProperty("value")) {
|
|
2654
|
-
d.value = o.bytes === String ? $util.base64.encode(m.value, 0, m.value.length) : o.bytes === Array ? Array.prototype.slice.call(m.value) : m.value;
|
|
2655
|
-
if (o.oneofs)
|
|
2656
|
-
d._value = "value";
|
|
2657
|
-
}
|
|
2658
|
-
return d;
|
|
2659
|
-
};
|
|
2660
|
-
|
|
2661
|
-
/**
|
|
2662
|
-
* Converts this DHTResponse to JSON.
|
|
2663
|
-
* @function toJSON
|
|
2664
|
-
* @memberof DHTResponse
|
|
2665
|
-
* @instance
|
|
2666
|
-
* @returns {Object.<string,*>} JSON object
|
|
2667
|
-
*/
|
|
2668
|
-
DHTResponse.prototype.toJSON = function toJSON() {
|
|
2669
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
2670
|
-
};
|
|
2671
|
-
|
|
2672
|
-
/**
|
|
2673
|
-
* Type enum.
|
|
2674
|
-
* @name DHTResponse.Type
|
|
2675
|
-
* @enum {number}
|
|
2676
|
-
* @property {number} BEGIN=0 BEGIN value
|
|
2677
|
-
* @property {number} VALUE=1 VALUE value
|
|
2678
|
-
* @property {number} END=2 END value
|
|
2679
|
-
*/
|
|
2680
|
-
DHTResponse.Type = (function() {
|
|
2681
|
-
const valuesById = {}, values = Object.create(valuesById);
|
|
2682
|
-
values[valuesById[0] = "BEGIN"] = 0;
|
|
2683
|
-
values[valuesById[1] = "VALUE"] = 1;
|
|
2684
|
-
values[valuesById[2] = "END"] = 2;
|
|
2685
|
-
return values;
|
|
2686
|
-
})();
|
|
2687
|
-
|
|
2688
|
-
return DHTResponse;
|
|
2689
|
-
})();
|
|
2690
|
-
|
|
2691
|
-
export const PeerInfo = $root.PeerInfo = (() => {
|
|
2692
|
-
|
|
2693
|
-
/**
|
|
2694
|
-
* Properties of a PeerInfo.
|
|
2695
|
-
* @exports IPeerInfo
|
|
2696
|
-
* @interface IPeerInfo
|
|
2697
|
-
* @property {Uint8Array} id PeerInfo id
|
|
2698
|
-
* @property {Array.<Uint8Array>|null} [addrs] PeerInfo addrs
|
|
2699
|
-
*/
|
|
2700
|
-
|
|
2701
|
-
/**
|
|
2702
|
-
* Constructs a new PeerInfo.
|
|
2703
|
-
* @exports PeerInfo
|
|
2704
|
-
* @classdesc Represents a PeerInfo.
|
|
2705
|
-
* @implements IPeerInfo
|
|
2706
|
-
* @constructor
|
|
2707
|
-
* @param {IPeerInfo=} [p] Properties to set
|
|
2708
|
-
*/
|
|
2709
|
-
function PeerInfo(p) {
|
|
2710
|
-
this.addrs = [];
|
|
2711
|
-
if (p)
|
|
2712
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
2713
|
-
if (p[ks[i]] != null)
|
|
2714
|
-
this[ks[i]] = p[ks[i]];
|
|
2715
|
-
}
|
|
2716
|
-
|
|
2717
|
-
/**
|
|
2718
|
-
* PeerInfo id.
|
|
2719
|
-
* @member {Uint8Array} id
|
|
2720
|
-
* @memberof PeerInfo
|
|
2721
|
-
* @instance
|
|
2722
|
-
*/
|
|
2723
|
-
PeerInfo.prototype.id = $util.newBuffer([]);
|
|
2724
|
-
|
|
2725
|
-
/**
|
|
2726
|
-
* PeerInfo addrs.
|
|
2727
|
-
* @member {Array.<Uint8Array>} addrs
|
|
2728
|
-
* @memberof PeerInfo
|
|
2729
|
-
* @instance
|
|
2730
|
-
*/
|
|
2731
|
-
PeerInfo.prototype.addrs = $util.emptyArray;
|
|
2732
|
-
|
|
2733
|
-
/**
|
|
2734
|
-
* Encodes the specified PeerInfo message. Does not implicitly {@link PeerInfo.verify|verify} messages.
|
|
2735
|
-
* @function encode
|
|
2736
|
-
* @memberof PeerInfo
|
|
2737
|
-
* @static
|
|
2738
|
-
* @param {IPeerInfo} m PeerInfo message or plain object to encode
|
|
2739
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
2740
|
-
* @returns {$protobuf.Writer} Writer
|
|
2741
|
-
*/
|
|
2742
|
-
PeerInfo.encode = function encode(m, w) {
|
|
2743
|
-
if (!w)
|
|
2744
|
-
w = $Writer.create();
|
|
2745
|
-
w.uint32(10).bytes(m.id);
|
|
2746
|
-
if (m.addrs != null && m.addrs.length) {
|
|
2747
|
-
for (var i = 0; i < m.addrs.length; ++i)
|
|
2748
|
-
w.uint32(18).bytes(m.addrs[i]);
|
|
2749
|
-
}
|
|
2750
|
-
return w;
|
|
2751
|
-
};
|
|
2752
|
-
|
|
2753
|
-
/**
|
|
2754
|
-
* Decodes a PeerInfo message from the specified reader or buffer.
|
|
2755
|
-
* @function decode
|
|
2756
|
-
* @memberof PeerInfo
|
|
2757
|
-
* @static
|
|
2758
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
2759
|
-
* @param {number} [l] Message length if known beforehand
|
|
2760
|
-
* @returns {PeerInfo} PeerInfo
|
|
2761
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
2762
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
2763
|
-
*/
|
|
2764
|
-
PeerInfo.decode = function decode(r, l) {
|
|
2765
|
-
if (!(r instanceof $Reader))
|
|
2766
|
-
r = $Reader.create(r);
|
|
2767
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.PeerInfo();
|
|
2768
|
-
while (r.pos < c) {
|
|
2769
|
-
var t = r.uint32();
|
|
2770
|
-
switch (t >>> 3) {
|
|
2771
|
-
case 1:
|
|
2772
|
-
m.id = r.bytes();
|
|
2773
|
-
break;
|
|
2774
|
-
case 2:
|
|
2775
|
-
if (!(m.addrs && m.addrs.length))
|
|
2776
|
-
m.addrs = [];
|
|
2777
|
-
m.addrs.push(r.bytes());
|
|
2778
|
-
break;
|
|
2779
|
-
default:
|
|
2780
|
-
r.skipType(t & 7);
|
|
2781
|
-
break;
|
|
2782
|
-
}
|
|
2783
|
-
}
|
|
2784
|
-
if (!m.hasOwnProperty("id"))
|
|
2785
|
-
throw $util.ProtocolError("missing required 'id'", { instance: m });
|
|
2786
|
-
return m;
|
|
2787
|
-
};
|
|
2788
|
-
|
|
2789
|
-
/**
|
|
2790
|
-
* Creates a PeerInfo message from a plain object. Also converts values to their respective internal types.
|
|
2791
|
-
* @function fromObject
|
|
2792
|
-
* @memberof PeerInfo
|
|
2793
|
-
* @static
|
|
2794
|
-
* @param {Object.<string,*>} d Plain object
|
|
2795
|
-
* @returns {PeerInfo} PeerInfo
|
|
2796
|
-
*/
|
|
2797
|
-
PeerInfo.fromObject = function fromObject(d) {
|
|
2798
|
-
if (d instanceof $root.PeerInfo)
|
|
2799
|
-
return d;
|
|
2800
|
-
var m = new $root.PeerInfo();
|
|
2801
|
-
if (d.id != null) {
|
|
2802
|
-
if (typeof d.id === "string")
|
|
2803
|
-
$util.base64.decode(d.id, m.id = $util.newBuffer($util.base64.length(d.id)), 0);
|
|
2804
|
-
else if (d.id.length)
|
|
2805
|
-
m.id = d.id;
|
|
2806
|
-
}
|
|
2807
|
-
if (d.addrs) {
|
|
2808
|
-
if (!Array.isArray(d.addrs))
|
|
2809
|
-
throw TypeError(".PeerInfo.addrs: array expected");
|
|
2810
|
-
m.addrs = [];
|
|
2811
|
-
for (var i = 0; i < d.addrs.length; ++i) {
|
|
2812
|
-
if (typeof d.addrs[i] === "string")
|
|
2813
|
-
$util.base64.decode(d.addrs[i], m.addrs[i] = $util.newBuffer($util.base64.length(d.addrs[i])), 0);
|
|
2814
|
-
else if (d.addrs[i].length)
|
|
2815
|
-
m.addrs[i] = d.addrs[i];
|
|
2816
|
-
}
|
|
2817
|
-
}
|
|
2818
|
-
return m;
|
|
2819
|
-
};
|
|
2820
|
-
|
|
2821
|
-
/**
|
|
2822
|
-
* Creates a plain object from a PeerInfo message. Also converts values to other types if specified.
|
|
2823
|
-
* @function toObject
|
|
2824
|
-
* @memberof PeerInfo
|
|
2825
|
-
* @static
|
|
2826
|
-
* @param {PeerInfo} m PeerInfo
|
|
2827
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
2828
|
-
* @returns {Object.<string,*>} Plain object
|
|
2829
|
-
*/
|
|
2830
|
-
PeerInfo.toObject = function toObject(m, o) {
|
|
2831
|
-
if (!o)
|
|
2832
|
-
o = {};
|
|
2833
|
-
var d = {};
|
|
2834
|
-
if (o.arrays || o.defaults) {
|
|
2835
|
-
d.addrs = [];
|
|
2836
|
-
}
|
|
2837
|
-
if (o.defaults) {
|
|
2838
|
-
if (o.bytes === String)
|
|
2839
|
-
d.id = "";
|
|
2840
|
-
else {
|
|
2841
|
-
d.id = [];
|
|
2842
|
-
if (o.bytes !== Array)
|
|
2843
|
-
d.id = $util.newBuffer(d.id);
|
|
2844
|
-
}
|
|
2845
|
-
}
|
|
2846
|
-
if (m.id != null && m.hasOwnProperty("id")) {
|
|
2847
|
-
d.id = o.bytes === String ? $util.base64.encode(m.id, 0, m.id.length) : o.bytes === Array ? Array.prototype.slice.call(m.id) : m.id;
|
|
2848
|
-
}
|
|
2849
|
-
if (m.addrs && m.addrs.length) {
|
|
2850
|
-
d.addrs = [];
|
|
2851
|
-
for (var j = 0; j < m.addrs.length; ++j) {
|
|
2852
|
-
d.addrs[j] = o.bytes === String ? $util.base64.encode(m.addrs[j], 0, m.addrs[j].length) : o.bytes === Array ? Array.prototype.slice.call(m.addrs[j]) : m.addrs[j];
|
|
2853
|
-
}
|
|
2854
|
-
}
|
|
2855
|
-
return d;
|
|
2856
|
-
};
|
|
2857
|
-
|
|
2858
|
-
/**
|
|
2859
|
-
* Converts this PeerInfo to JSON.
|
|
2860
|
-
* @function toJSON
|
|
2861
|
-
* @memberof PeerInfo
|
|
2862
|
-
* @instance
|
|
2863
|
-
* @returns {Object.<string,*>} JSON object
|
|
2864
|
-
*/
|
|
2865
|
-
PeerInfo.prototype.toJSON = function toJSON() {
|
|
2866
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
2867
|
-
};
|
|
2868
|
-
|
|
2869
|
-
return PeerInfo;
|
|
2870
|
-
})();
|
|
2871
|
-
|
|
2872
|
-
export const ConnManagerRequest = $root.ConnManagerRequest = (() => {
|
|
2873
|
-
|
|
2874
|
-
/**
|
|
2875
|
-
* Properties of a ConnManagerRequest.
|
|
2876
|
-
* @exports IConnManagerRequest
|
|
2877
|
-
* @interface IConnManagerRequest
|
|
2878
|
-
* @property {ConnManagerRequest.Type} type ConnManagerRequest type
|
|
2879
|
-
* @property {Uint8Array|null} [peer] ConnManagerRequest peer
|
|
2880
|
-
* @property {string|null} [tag] ConnManagerRequest tag
|
|
2881
|
-
* @property {number|null} [weight] ConnManagerRequest weight
|
|
2882
|
-
*/
|
|
2883
|
-
|
|
2884
|
-
/**
|
|
2885
|
-
* Constructs a new ConnManagerRequest.
|
|
2886
|
-
* @exports ConnManagerRequest
|
|
2887
|
-
* @classdesc Represents a ConnManagerRequest.
|
|
2888
|
-
* @implements IConnManagerRequest
|
|
2889
|
-
* @constructor
|
|
2890
|
-
* @param {IConnManagerRequest=} [p] Properties to set
|
|
2891
|
-
*/
|
|
2892
|
-
function ConnManagerRequest(p) {
|
|
2893
|
-
if (p)
|
|
2894
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
2895
|
-
if (p[ks[i]] != null)
|
|
2896
|
-
this[ks[i]] = p[ks[i]];
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
/**
|
|
2900
|
-
* ConnManagerRequest type.
|
|
2901
|
-
* @member {ConnManagerRequest.Type} type
|
|
2902
|
-
* @memberof ConnManagerRequest
|
|
2903
|
-
* @instance
|
|
2904
|
-
*/
|
|
2905
|
-
ConnManagerRequest.prototype.type = 0;
|
|
2906
|
-
|
|
2907
|
-
/**
|
|
2908
|
-
* ConnManagerRequest peer.
|
|
2909
|
-
* @member {Uint8Array|null|undefined} peer
|
|
2910
|
-
* @memberof ConnManagerRequest
|
|
2911
|
-
* @instance
|
|
2912
|
-
*/
|
|
2913
|
-
ConnManagerRequest.prototype.peer = null;
|
|
2914
|
-
|
|
2915
|
-
/**
|
|
2916
|
-
* ConnManagerRequest tag.
|
|
2917
|
-
* @member {string|null|undefined} tag
|
|
2918
|
-
* @memberof ConnManagerRequest
|
|
2919
|
-
* @instance
|
|
2920
|
-
*/
|
|
2921
|
-
ConnManagerRequest.prototype.tag = null;
|
|
2922
|
-
|
|
2923
|
-
/**
|
|
2924
|
-
* ConnManagerRequest weight.
|
|
2925
|
-
* @member {number|null|undefined} weight
|
|
2926
|
-
* @memberof ConnManagerRequest
|
|
2927
|
-
* @instance
|
|
2928
|
-
*/
|
|
2929
|
-
ConnManagerRequest.prototype.weight = null;
|
|
2930
|
-
|
|
2931
|
-
// OneOf field names bound to virtual getters and setters
|
|
2932
|
-
let $oneOfFields;
|
|
2933
|
-
|
|
2934
|
-
/**
|
|
2935
|
-
* ConnManagerRequest _peer.
|
|
2936
|
-
* @member {"peer"|undefined} _peer
|
|
2937
|
-
* @memberof ConnManagerRequest
|
|
2938
|
-
* @instance
|
|
2939
|
-
*/
|
|
2940
|
-
Object.defineProperty(ConnManagerRequest.prototype, "_peer", {
|
|
2941
|
-
get: $util.oneOfGetter($oneOfFields = ["peer"]),
|
|
2942
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2943
|
-
});
|
|
2944
|
-
|
|
2945
|
-
/**
|
|
2946
|
-
* ConnManagerRequest _tag.
|
|
2947
|
-
* @member {"tag"|undefined} _tag
|
|
2948
|
-
* @memberof ConnManagerRequest
|
|
2949
|
-
* @instance
|
|
2950
|
-
*/
|
|
2951
|
-
Object.defineProperty(ConnManagerRequest.prototype, "_tag", {
|
|
2952
|
-
get: $util.oneOfGetter($oneOfFields = ["tag"]),
|
|
2953
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2954
|
-
});
|
|
2955
|
-
|
|
2956
|
-
/**
|
|
2957
|
-
* ConnManagerRequest _weight.
|
|
2958
|
-
* @member {"weight"|undefined} _weight
|
|
2959
|
-
* @memberof ConnManagerRequest
|
|
2960
|
-
* @instance
|
|
2961
|
-
*/
|
|
2962
|
-
Object.defineProperty(ConnManagerRequest.prototype, "_weight", {
|
|
2963
|
-
get: $util.oneOfGetter($oneOfFields = ["weight"]),
|
|
2964
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
2965
|
-
});
|
|
2966
|
-
|
|
2967
|
-
/**
|
|
2968
|
-
* Encodes the specified ConnManagerRequest message. Does not implicitly {@link ConnManagerRequest.verify|verify} messages.
|
|
2969
|
-
* @function encode
|
|
2970
|
-
* @memberof ConnManagerRequest
|
|
2971
|
-
* @static
|
|
2972
|
-
* @param {IConnManagerRequest} m ConnManagerRequest message or plain object to encode
|
|
2973
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
2974
|
-
* @returns {$protobuf.Writer} Writer
|
|
2975
|
-
*/
|
|
2976
|
-
ConnManagerRequest.encode = function encode(m, w) {
|
|
2977
|
-
if (!w)
|
|
2978
|
-
w = $Writer.create();
|
|
2979
|
-
w.uint32(8).int32(m.type);
|
|
2980
|
-
if (m.peer != null && Object.hasOwnProperty.call(m, "peer"))
|
|
2981
|
-
w.uint32(18).bytes(m.peer);
|
|
2982
|
-
if (m.tag != null && Object.hasOwnProperty.call(m, "tag"))
|
|
2983
|
-
w.uint32(26).string(m.tag);
|
|
2984
|
-
if (m.weight != null && Object.hasOwnProperty.call(m, "weight"))
|
|
2985
|
-
w.uint32(32).int64(m.weight);
|
|
2986
|
-
return w;
|
|
2987
|
-
};
|
|
2988
|
-
|
|
2989
|
-
/**
|
|
2990
|
-
* Decodes a ConnManagerRequest message from the specified reader or buffer.
|
|
2991
|
-
* @function decode
|
|
2992
|
-
* @memberof ConnManagerRequest
|
|
2993
|
-
* @static
|
|
2994
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
2995
|
-
* @param {number} [l] Message length if known beforehand
|
|
2996
|
-
* @returns {ConnManagerRequest} ConnManagerRequest
|
|
2997
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
2998
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
2999
|
-
*/
|
|
3000
|
-
ConnManagerRequest.decode = function decode(r, l) {
|
|
3001
|
-
if (!(r instanceof $Reader))
|
|
3002
|
-
r = $Reader.create(r);
|
|
3003
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.ConnManagerRequest();
|
|
3004
|
-
while (r.pos < c) {
|
|
3005
|
-
var t = r.uint32();
|
|
3006
|
-
switch (t >>> 3) {
|
|
3007
|
-
case 1:
|
|
3008
|
-
m.type = r.int32();
|
|
3009
|
-
break;
|
|
3010
|
-
case 2:
|
|
3011
|
-
m.peer = r.bytes();
|
|
3012
|
-
break;
|
|
3013
|
-
case 3:
|
|
3014
|
-
m.tag = r.string();
|
|
3015
|
-
break;
|
|
3016
|
-
case 4:
|
|
3017
|
-
m.weight = r.int64();
|
|
3018
|
-
break;
|
|
3019
|
-
default:
|
|
3020
|
-
r.skipType(t & 7);
|
|
3021
|
-
break;
|
|
3022
|
-
}
|
|
3023
|
-
}
|
|
3024
|
-
if (!m.hasOwnProperty("type"))
|
|
3025
|
-
throw $util.ProtocolError("missing required 'type'", { instance: m });
|
|
3026
|
-
return m;
|
|
3027
|
-
};
|
|
3028
|
-
|
|
3029
|
-
/**
|
|
3030
|
-
* Creates a ConnManagerRequest message from a plain object. Also converts values to their respective internal types.
|
|
3031
|
-
* @function fromObject
|
|
3032
|
-
* @memberof ConnManagerRequest
|
|
3033
|
-
* @static
|
|
3034
|
-
* @param {Object.<string,*>} d Plain object
|
|
3035
|
-
* @returns {ConnManagerRequest} ConnManagerRequest
|
|
3036
|
-
*/
|
|
3037
|
-
ConnManagerRequest.fromObject = function fromObject(d) {
|
|
3038
|
-
if (d instanceof $root.ConnManagerRequest)
|
|
3039
|
-
return d;
|
|
3040
|
-
var m = new $root.ConnManagerRequest();
|
|
3041
|
-
switch (d.type) {
|
|
3042
|
-
case "TAG_PEER":
|
|
3043
|
-
case 0:
|
|
3044
|
-
m.type = 0;
|
|
3045
|
-
break;
|
|
3046
|
-
case "UNTAG_PEER":
|
|
3047
|
-
case 1:
|
|
3048
|
-
m.type = 1;
|
|
3049
|
-
break;
|
|
3050
|
-
case "TRIM":
|
|
3051
|
-
case 2:
|
|
3052
|
-
m.type = 2;
|
|
3053
|
-
break;
|
|
3054
|
-
}
|
|
3055
|
-
if (d.peer != null) {
|
|
3056
|
-
if (typeof d.peer === "string")
|
|
3057
|
-
$util.base64.decode(d.peer, m.peer = $util.newBuffer($util.base64.length(d.peer)), 0);
|
|
3058
|
-
else if (d.peer.length)
|
|
3059
|
-
m.peer = d.peer;
|
|
3060
|
-
}
|
|
3061
|
-
if (d.tag != null) {
|
|
3062
|
-
m.tag = String(d.tag);
|
|
3063
|
-
}
|
|
3064
|
-
if (d.weight != null) {
|
|
3065
|
-
if ($util.Long)
|
|
3066
|
-
(m.weight = $util.Long.fromValue(d.weight)).unsigned = false;
|
|
3067
|
-
else if (typeof d.weight === "string")
|
|
3068
|
-
m.weight = parseInt(d.weight, 10);
|
|
3069
|
-
else if (typeof d.weight === "number")
|
|
3070
|
-
m.weight = d.weight;
|
|
3071
|
-
else if (typeof d.weight === "object")
|
|
3072
|
-
m.weight = new $util.LongBits(d.weight.low >>> 0, d.weight.high >>> 0).toNumber();
|
|
3073
|
-
}
|
|
3074
|
-
return m;
|
|
3075
|
-
};
|
|
3076
|
-
|
|
3077
|
-
/**
|
|
3078
|
-
* Creates a plain object from a ConnManagerRequest message. Also converts values to other types if specified.
|
|
3079
|
-
* @function toObject
|
|
3080
|
-
* @memberof ConnManagerRequest
|
|
3081
|
-
* @static
|
|
3082
|
-
* @param {ConnManagerRequest} m ConnManagerRequest
|
|
3083
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
3084
|
-
* @returns {Object.<string,*>} Plain object
|
|
3085
|
-
*/
|
|
3086
|
-
ConnManagerRequest.toObject = function toObject(m, o) {
|
|
3087
|
-
if (!o)
|
|
3088
|
-
o = {};
|
|
3089
|
-
var d = {};
|
|
3090
|
-
if (o.defaults) {
|
|
3091
|
-
d.type = o.enums === String ? "TAG_PEER" : 0;
|
|
3092
|
-
}
|
|
3093
|
-
if (m.type != null && m.hasOwnProperty("type")) {
|
|
3094
|
-
d.type = o.enums === String ? $root.ConnManagerRequest.Type[m.type] : m.type;
|
|
3095
|
-
}
|
|
3096
|
-
if (m.peer != null && m.hasOwnProperty("peer")) {
|
|
3097
|
-
d.peer = o.bytes === String ? $util.base64.encode(m.peer, 0, m.peer.length) : o.bytes === Array ? Array.prototype.slice.call(m.peer) : m.peer;
|
|
3098
|
-
if (o.oneofs)
|
|
3099
|
-
d._peer = "peer";
|
|
3100
|
-
}
|
|
3101
|
-
if (m.tag != null && m.hasOwnProperty("tag")) {
|
|
3102
|
-
d.tag = m.tag;
|
|
3103
|
-
if (o.oneofs)
|
|
3104
|
-
d._tag = "tag";
|
|
3105
|
-
}
|
|
3106
|
-
if (m.weight != null && m.hasOwnProperty("weight")) {
|
|
3107
|
-
if (typeof m.weight === "number")
|
|
3108
|
-
d.weight = o.longs === String ? String(m.weight) : m.weight;
|
|
3109
|
-
else
|
|
3110
|
-
d.weight = o.longs === String ? $util.Long.prototype.toString.call(m.weight) : o.longs === Number ? new $util.LongBits(m.weight.low >>> 0, m.weight.high >>> 0).toNumber() : m.weight;
|
|
3111
|
-
if (o.oneofs)
|
|
3112
|
-
d._weight = "weight";
|
|
3113
|
-
}
|
|
3114
|
-
return d;
|
|
3115
|
-
};
|
|
3116
|
-
|
|
3117
|
-
/**
|
|
3118
|
-
* Converts this ConnManagerRequest to JSON.
|
|
3119
|
-
* @function toJSON
|
|
3120
|
-
* @memberof ConnManagerRequest
|
|
3121
|
-
* @instance
|
|
3122
|
-
* @returns {Object.<string,*>} JSON object
|
|
3123
|
-
*/
|
|
3124
|
-
ConnManagerRequest.prototype.toJSON = function toJSON() {
|
|
3125
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
3126
|
-
};
|
|
3127
|
-
|
|
3128
|
-
/**
|
|
3129
|
-
* Type enum.
|
|
3130
|
-
* @name ConnManagerRequest.Type
|
|
3131
|
-
* @enum {number}
|
|
3132
|
-
* @property {number} TAG_PEER=0 TAG_PEER value
|
|
3133
|
-
* @property {number} UNTAG_PEER=1 UNTAG_PEER value
|
|
3134
|
-
* @property {number} TRIM=2 TRIM value
|
|
3135
|
-
*/
|
|
3136
|
-
ConnManagerRequest.Type = (function() {
|
|
3137
|
-
const valuesById = {}, values = Object.create(valuesById);
|
|
3138
|
-
values[valuesById[0] = "TAG_PEER"] = 0;
|
|
3139
|
-
values[valuesById[1] = "UNTAG_PEER"] = 1;
|
|
3140
|
-
values[valuesById[2] = "TRIM"] = 2;
|
|
3141
|
-
return values;
|
|
3142
|
-
})();
|
|
3143
|
-
|
|
3144
|
-
return ConnManagerRequest;
|
|
3145
|
-
})();
|
|
3146
|
-
|
|
3147
|
-
export const DisconnectRequest = $root.DisconnectRequest = (() => {
|
|
3148
|
-
|
|
3149
|
-
/**
|
|
3150
|
-
* Properties of a DisconnectRequest.
|
|
3151
|
-
* @exports IDisconnectRequest
|
|
3152
|
-
* @interface IDisconnectRequest
|
|
3153
|
-
* @property {Uint8Array} peer DisconnectRequest peer
|
|
3154
|
-
*/
|
|
3155
|
-
|
|
3156
|
-
/**
|
|
3157
|
-
* Constructs a new DisconnectRequest.
|
|
3158
|
-
* @exports DisconnectRequest
|
|
3159
|
-
* @classdesc Represents a DisconnectRequest.
|
|
3160
|
-
* @implements IDisconnectRequest
|
|
3161
|
-
* @constructor
|
|
3162
|
-
* @param {IDisconnectRequest=} [p] Properties to set
|
|
3163
|
-
*/
|
|
3164
|
-
function DisconnectRequest(p) {
|
|
3165
|
-
if (p)
|
|
3166
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
3167
|
-
if (p[ks[i]] != null)
|
|
3168
|
-
this[ks[i]] = p[ks[i]];
|
|
3169
|
-
}
|
|
3170
|
-
|
|
3171
|
-
/**
|
|
3172
|
-
* DisconnectRequest peer.
|
|
3173
|
-
* @member {Uint8Array} peer
|
|
3174
|
-
* @memberof DisconnectRequest
|
|
3175
|
-
* @instance
|
|
3176
|
-
*/
|
|
3177
|
-
DisconnectRequest.prototype.peer = $util.newBuffer([]);
|
|
3178
|
-
|
|
3179
|
-
/**
|
|
3180
|
-
* Encodes the specified DisconnectRequest message. Does not implicitly {@link DisconnectRequest.verify|verify} messages.
|
|
3181
|
-
* @function encode
|
|
3182
|
-
* @memberof DisconnectRequest
|
|
3183
|
-
* @static
|
|
3184
|
-
* @param {IDisconnectRequest} m DisconnectRequest message or plain object to encode
|
|
3185
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
3186
|
-
* @returns {$protobuf.Writer} Writer
|
|
3187
|
-
*/
|
|
3188
|
-
DisconnectRequest.encode = function encode(m, w) {
|
|
3189
|
-
if (!w)
|
|
3190
|
-
w = $Writer.create();
|
|
3191
|
-
w.uint32(10).bytes(m.peer);
|
|
3192
|
-
return w;
|
|
3193
|
-
};
|
|
3194
|
-
|
|
3195
|
-
/**
|
|
3196
|
-
* Decodes a DisconnectRequest message from the specified reader or buffer.
|
|
3197
|
-
* @function decode
|
|
3198
|
-
* @memberof DisconnectRequest
|
|
3199
|
-
* @static
|
|
3200
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
3201
|
-
* @param {number} [l] Message length if known beforehand
|
|
3202
|
-
* @returns {DisconnectRequest} DisconnectRequest
|
|
3203
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
3204
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
3205
|
-
*/
|
|
3206
|
-
DisconnectRequest.decode = function decode(r, l) {
|
|
3207
|
-
if (!(r instanceof $Reader))
|
|
3208
|
-
r = $Reader.create(r);
|
|
3209
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.DisconnectRequest();
|
|
3210
|
-
while (r.pos < c) {
|
|
3211
|
-
var t = r.uint32();
|
|
3212
|
-
switch (t >>> 3) {
|
|
3213
|
-
case 1:
|
|
3214
|
-
m.peer = r.bytes();
|
|
3215
|
-
break;
|
|
3216
|
-
default:
|
|
3217
|
-
r.skipType(t & 7);
|
|
3218
|
-
break;
|
|
3219
|
-
}
|
|
3220
|
-
}
|
|
3221
|
-
if (!m.hasOwnProperty("peer"))
|
|
3222
|
-
throw $util.ProtocolError("missing required 'peer'", { instance: m });
|
|
3223
|
-
return m;
|
|
3224
|
-
};
|
|
3225
|
-
|
|
3226
|
-
/**
|
|
3227
|
-
* Creates a DisconnectRequest message from a plain object. Also converts values to their respective internal types.
|
|
3228
|
-
* @function fromObject
|
|
3229
|
-
* @memberof DisconnectRequest
|
|
3230
|
-
* @static
|
|
3231
|
-
* @param {Object.<string,*>} d Plain object
|
|
3232
|
-
* @returns {DisconnectRequest} DisconnectRequest
|
|
3233
|
-
*/
|
|
3234
|
-
DisconnectRequest.fromObject = function fromObject(d) {
|
|
3235
|
-
if (d instanceof $root.DisconnectRequest)
|
|
3236
|
-
return d;
|
|
3237
|
-
var m = new $root.DisconnectRequest();
|
|
3238
|
-
if (d.peer != null) {
|
|
3239
|
-
if (typeof d.peer === "string")
|
|
3240
|
-
$util.base64.decode(d.peer, m.peer = $util.newBuffer($util.base64.length(d.peer)), 0);
|
|
3241
|
-
else if (d.peer.length)
|
|
3242
|
-
m.peer = d.peer;
|
|
3243
|
-
}
|
|
3244
|
-
return m;
|
|
3245
|
-
};
|
|
3246
|
-
|
|
3247
|
-
/**
|
|
3248
|
-
* Creates a plain object from a DisconnectRequest message. Also converts values to other types if specified.
|
|
3249
|
-
* @function toObject
|
|
3250
|
-
* @memberof DisconnectRequest
|
|
3251
|
-
* @static
|
|
3252
|
-
* @param {DisconnectRequest} m DisconnectRequest
|
|
3253
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
3254
|
-
* @returns {Object.<string,*>} Plain object
|
|
3255
|
-
*/
|
|
3256
|
-
DisconnectRequest.toObject = function toObject(m, o) {
|
|
3257
|
-
if (!o)
|
|
3258
|
-
o = {};
|
|
3259
|
-
var d = {};
|
|
3260
|
-
if (o.defaults) {
|
|
3261
|
-
if (o.bytes === String)
|
|
3262
|
-
d.peer = "";
|
|
3263
|
-
else {
|
|
3264
|
-
d.peer = [];
|
|
3265
|
-
if (o.bytes !== Array)
|
|
3266
|
-
d.peer = $util.newBuffer(d.peer);
|
|
3267
|
-
}
|
|
3268
|
-
}
|
|
3269
|
-
if (m.peer != null && m.hasOwnProperty("peer")) {
|
|
3270
|
-
d.peer = o.bytes === String ? $util.base64.encode(m.peer, 0, m.peer.length) : o.bytes === Array ? Array.prototype.slice.call(m.peer) : m.peer;
|
|
3271
|
-
}
|
|
3272
|
-
return d;
|
|
3273
|
-
};
|
|
3274
|
-
|
|
3275
|
-
/**
|
|
3276
|
-
* Converts this DisconnectRequest to JSON.
|
|
3277
|
-
* @function toJSON
|
|
3278
|
-
* @memberof DisconnectRequest
|
|
3279
|
-
* @instance
|
|
3280
|
-
* @returns {Object.<string,*>} JSON object
|
|
3281
|
-
*/
|
|
3282
|
-
DisconnectRequest.prototype.toJSON = function toJSON() {
|
|
3283
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
3284
|
-
};
|
|
3285
|
-
|
|
3286
|
-
return DisconnectRequest;
|
|
3287
|
-
})();
|
|
3288
|
-
|
|
3289
|
-
export const PSRequest = $root.PSRequest = (() => {
|
|
3290
|
-
|
|
3291
|
-
/**
|
|
3292
|
-
* Properties of a PSRequest.
|
|
3293
|
-
* @exports IPSRequest
|
|
3294
|
-
* @interface IPSRequest
|
|
3295
|
-
* @property {PSRequest.Type} type PSRequest type
|
|
3296
|
-
* @property {string|null} [topic] PSRequest topic
|
|
3297
|
-
* @property {Uint8Array|null} [data] PSRequest data
|
|
3298
|
-
*/
|
|
3299
|
-
|
|
3300
|
-
/**
|
|
3301
|
-
* Constructs a new PSRequest.
|
|
3302
|
-
* @exports PSRequest
|
|
3303
|
-
* @classdesc Represents a PSRequest.
|
|
3304
|
-
* @implements IPSRequest
|
|
3305
|
-
* @constructor
|
|
3306
|
-
* @param {IPSRequest=} [p] Properties to set
|
|
3307
|
-
*/
|
|
3308
|
-
function PSRequest(p) {
|
|
3309
|
-
if (p)
|
|
3310
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
3311
|
-
if (p[ks[i]] != null)
|
|
3312
|
-
this[ks[i]] = p[ks[i]];
|
|
3313
|
-
}
|
|
3314
|
-
|
|
3315
|
-
/**
|
|
3316
|
-
* PSRequest type.
|
|
3317
|
-
* @member {PSRequest.Type} type
|
|
3318
|
-
* @memberof PSRequest
|
|
3319
|
-
* @instance
|
|
3320
|
-
*/
|
|
3321
|
-
PSRequest.prototype.type = 0;
|
|
3322
|
-
|
|
3323
|
-
/**
|
|
3324
|
-
* PSRequest topic.
|
|
3325
|
-
* @member {string|null|undefined} topic
|
|
3326
|
-
* @memberof PSRequest
|
|
3327
|
-
* @instance
|
|
3328
|
-
*/
|
|
3329
|
-
PSRequest.prototype.topic = null;
|
|
3330
|
-
|
|
3331
|
-
/**
|
|
3332
|
-
* PSRequest data.
|
|
3333
|
-
* @member {Uint8Array|null|undefined} data
|
|
3334
|
-
* @memberof PSRequest
|
|
3335
|
-
* @instance
|
|
3336
|
-
*/
|
|
3337
|
-
PSRequest.prototype.data = null;
|
|
3338
|
-
|
|
3339
|
-
// OneOf field names bound to virtual getters and setters
|
|
3340
|
-
let $oneOfFields;
|
|
3341
|
-
|
|
3342
|
-
/**
|
|
3343
|
-
* PSRequest _topic.
|
|
3344
|
-
* @member {"topic"|undefined} _topic
|
|
3345
|
-
* @memberof PSRequest
|
|
3346
|
-
* @instance
|
|
3347
|
-
*/
|
|
3348
|
-
Object.defineProperty(PSRequest.prototype, "_topic", {
|
|
3349
|
-
get: $util.oneOfGetter($oneOfFields = ["topic"]),
|
|
3350
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
3351
|
-
});
|
|
3352
|
-
|
|
3353
|
-
/**
|
|
3354
|
-
* PSRequest _data.
|
|
3355
|
-
* @member {"data"|undefined} _data
|
|
3356
|
-
* @memberof PSRequest
|
|
3357
|
-
* @instance
|
|
3358
|
-
*/
|
|
3359
|
-
Object.defineProperty(PSRequest.prototype, "_data", {
|
|
3360
|
-
get: $util.oneOfGetter($oneOfFields = ["data"]),
|
|
3361
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
3362
|
-
});
|
|
3363
|
-
|
|
3364
|
-
/**
|
|
3365
|
-
* Encodes the specified PSRequest message. Does not implicitly {@link PSRequest.verify|verify} messages.
|
|
3366
|
-
* @function encode
|
|
3367
|
-
* @memberof PSRequest
|
|
3368
|
-
* @static
|
|
3369
|
-
* @param {IPSRequest} m PSRequest message or plain object to encode
|
|
3370
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
3371
|
-
* @returns {$protobuf.Writer} Writer
|
|
3372
|
-
*/
|
|
3373
|
-
PSRequest.encode = function encode(m, w) {
|
|
3374
|
-
if (!w)
|
|
3375
|
-
w = $Writer.create();
|
|
3376
|
-
w.uint32(8).int32(m.type);
|
|
3377
|
-
if (m.topic != null && Object.hasOwnProperty.call(m, "topic"))
|
|
3378
|
-
w.uint32(18).string(m.topic);
|
|
3379
|
-
if (m.data != null && Object.hasOwnProperty.call(m, "data"))
|
|
3380
|
-
w.uint32(26).bytes(m.data);
|
|
3381
|
-
return w;
|
|
3382
|
-
};
|
|
3383
|
-
|
|
3384
|
-
/**
|
|
3385
|
-
* Decodes a PSRequest message from the specified reader or buffer.
|
|
3386
|
-
* @function decode
|
|
3387
|
-
* @memberof PSRequest
|
|
3388
|
-
* @static
|
|
3389
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
3390
|
-
* @param {number} [l] Message length if known beforehand
|
|
3391
|
-
* @returns {PSRequest} PSRequest
|
|
3392
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
3393
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
3394
|
-
*/
|
|
3395
|
-
PSRequest.decode = function decode(r, l) {
|
|
3396
|
-
if (!(r instanceof $Reader))
|
|
3397
|
-
r = $Reader.create(r);
|
|
3398
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.PSRequest();
|
|
3399
|
-
while (r.pos < c) {
|
|
3400
|
-
var t = r.uint32();
|
|
3401
|
-
switch (t >>> 3) {
|
|
3402
|
-
case 1:
|
|
3403
|
-
m.type = r.int32();
|
|
3404
|
-
break;
|
|
3405
|
-
case 2:
|
|
3406
|
-
m.topic = r.string();
|
|
3407
|
-
break;
|
|
3408
|
-
case 3:
|
|
3409
|
-
m.data = r.bytes();
|
|
3410
|
-
break;
|
|
3411
|
-
default:
|
|
3412
|
-
r.skipType(t & 7);
|
|
3413
|
-
break;
|
|
3414
|
-
}
|
|
3415
|
-
}
|
|
3416
|
-
if (!m.hasOwnProperty("type"))
|
|
3417
|
-
throw $util.ProtocolError("missing required 'type'", { instance: m });
|
|
3418
|
-
return m;
|
|
3419
|
-
};
|
|
3420
|
-
|
|
3421
|
-
/**
|
|
3422
|
-
* Creates a PSRequest message from a plain object. Also converts values to their respective internal types.
|
|
3423
|
-
* @function fromObject
|
|
3424
|
-
* @memberof PSRequest
|
|
3425
|
-
* @static
|
|
3426
|
-
* @param {Object.<string,*>} d Plain object
|
|
3427
|
-
* @returns {PSRequest} PSRequest
|
|
3428
|
-
*/
|
|
3429
|
-
PSRequest.fromObject = function fromObject(d) {
|
|
3430
|
-
if (d instanceof $root.PSRequest)
|
|
3431
|
-
return d;
|
|
3432
|
-
var m = new $root.PSRequest();
|
|
3433
|
-
switch (d.type) {
|
|
3434
|
-
case "GET_TOPICS":
|
|
3435
|
-
case 0:
|
|
3436
|
-
m.type = 0;
|
|
3437
|
-
break;
|
|
3438
|
-
case "LIST_PEERS":
|
|
3439
|
-
case 1:
|
|
3440
|
-
m.type = 1;
|
|
3441
|
-
break;
|
|
3442
|
-
case "PUBLISH":
|
|
3443
|
-
case 2:
|
|
3444
|
-
m.type = 2;
|
|
3445
|
-
break;
|
|
3446
|
-
case "SUBSCRIBE":
|
|
3447
|
-
case 3:
|
|
3448
|
-
m.type = 3;
|
|
3449
|
-
break;
|
|
3450
|
-
}
|
|
3451
|
-
if (d.topic != null) {
|
|
3452
|
-
m.topic = String(d.topic);
|
|
3453
|
-
}
|
|
3454
|
-
if (d.data != null) {
|
|
3455
|
-
if (typeof d.data === "string")
|
|
3456
|
-
$util.base64.decode(d.data, m.data = $util.newBuffer($util.base64.length(d.data)), 0);
|
|
3457
|
-
else if (d.data.length)
|
|
3458
|
-
m.data = d.data;
|
|
3459
|
-
}
|
|
3460
|
-
return m;
|
|
3461
|
-
};
|
|
3462
|
-
|
|
3463
|
-
/**
|
|
3464
|
-
* Creates a plain object from a PSRequest message. Also converts values to other types if specified.
|
|
3465
|
-
* @function toObject
|
|
3466
|
-
* @memberof PSRequest
|
|
3467
|
-
* @static
|
|
3468
|
-
* @param {PSRequest} m PSRequest
|
|
3469
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
3470
|
-
* @returns {Object.<string,*>} Plain object
|
|
3471
|
-
*/
|
|
3472
|
-
PSRequest.toObject = function toObject(m, o) {
|
|
3473
|
-
if (!o)
|
|
3474
|
-
o = {};
|
|
3475
|
-
var d = {};
|
|
3476
|
-
if (o.defaults) {
|
|
3477
|
-
d.type = o.enums === String ? "GET_TOPICS" : 0;
|
|
3478
|
-
}
|
|
3479
|
-
if (m.type != null && m.hasOwnProperty("type")) {
|
|
3480
|
-
d.type = o.enums === String ? $root.PSRequest.Type[m.type] : m.type;
|
|
3481
|
-
}
|
|
3482
|
-
if (m.topic != null && m.hasOwnProperty("topic")) {
|
|
3483
|
-
d.topic = m.topic;
|
|
3484
|
-
if (o.oneofs)
|
|
3485
|
-
d._topic = "topic";
|
|
3486
|
-
}
|
|
3487
|
-
if (m.data != null && m.hasOwnProperty("data")) {
|
|
3488
|
-
d.data = o.bytes === String ? $util.base64.encode(m.data, 0, m.data.length) : o.bytes === Array ? Array.prototype.slice.call(m.data) : m.data;
|
|
3489
|
-
if (o.oneofs)
|
|
3490
|
-
d._data = "data";
|
|
3491
|
-
}
|
|
3492
|
-
return d;
|
|
3493
|
-
};
|
|
3494
|
-
|
|
3495
|
-
/**
|
|
3496
|
-
* Converts this PSRequest to JSON.
|
|
3497
|
-
* @function toJSON
|
|
3498
|
-
* @memberof PSRequest
|
|
3499
|
-
* @instance
|
|
3500
|
-
* @returns {Object.<string,*>} JSON object
|
|
3501
|
-
*/
|
|
3502
|
-
PSRequest.prototype.toJSON = function toJSON() {
|
|
3503
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
3504
|
-
};
|
|
3505
|
-
|
|
3506
|
-
/**
|
|
3507
|
-
* Type enum.
|
|
3508
|
-
* @name PSRequest.Type
|
|
3509
|
-
* @enum {number}
|
|
3510
|
-
* @property {number} GET_TOPICS=0 GET_TOPICS value
|
|
3511
|
-
* @property {number} LIST_PEERS=1 LIST_PEERS value
|
|
3512
|
-
* @property {number} PUBLISH=2 PUBLISH value
|
|
3513
|
-
* @property {number} SUBSCRIBE=3 SUBSCRIBE value
|
|
3514
|
-
*/
|
|
3515
|
-
PSRequest.Type = (function() {
|
|
3516
|
-
const valuesById = {}, values = Object.create(valuesById);
|
|
3517
|
-
values[valuesById[0] = "GET_TOPICS"] = 0;
|
|
3518
|
-
values[valuesById[1] = "LIST_PEERS"] = 1;
|
|
3519
|
-
values[valuesById[2] = "PUBLISH"] = 2;
|
|
3520
|
-
values[valuesById[3] = "SUBSCRIBE"] = 3;
|
|
3521
|
-
return values;
|
|
3522
|
-
})();
|
|
3523
|
-
|
|
3524
|
-
return PSRequest;
|
|
3525
|
-
})();
|
|
3526
|
-
|
|
3527
|
-
export const PSMessage = $root.PSMessage = (() => {
|
|
3528
|
-
|
|
3529
|
-
/**
|
|
3530
|
-
* Properties of a PSMessage.
|
|
3531
|
-
* @exports IPSMessage
|
|
3532
|
-
* @interface IPSMessage
|
|
3533
|
-
* @property {Uint8Array|null} [from] PSMessage from
|
|
3534
|
-
* @property {Uint8Array|null} [data] PSMessage data
|
|
3535
|
-
* @property {Uint8Array|null} [seqno] PSMessage seqno
|
|
3536
|
-
* @property {Array.<string>|null} [topicIDs] PSMessage topicIDs
|
|
3537
|
-
* @property {Uint8Array|null} [signature] PSMessage signature
|
|
3538
|
-
* @property {Uint8Array|null} [key] PSMessage key
|
|
3539
|
-
*/
|
|
3540
|
-
|
|
3541
|
-
/**
|
|
3542
|
-
* Constructs a new PSMessage.
|
|
3543
|
-
* @exports PSMessage
|
|
3544
|
-
* @classdesc Represents a PSMessage.
|
|
3545
|
-
* @implements IPSMessage
|
|
3546
|
-
* @constructor
|
|
3547
|
-
* @param {IPSMessage=} [p] Properties to set
|
|
3548
|
-
*/
|
|
3549
|
-
function PSMessage(p) {
|
|
3550
|
-
this.topicIDs = [];
|
|
3551
|
-
if (p)
|
|
3552
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
3553
|
-
if (p[ks[i]] != null)
|
|
3554
|
-
this[ks[i]] = p[ks[i]];
|
|
3555
|
-
}
|
|
3556
|
-
|
|
3557
|
-
/**
|
|
3558
|
-
* PSMessage from.
|
|
3559
|
-
* @member {Uint8Array|null|undefined} from
|
|
3560
|
-
* @memberof PSMessage
|
|
3561
|
-
* @instance
|
|
3562
|
-
*/
|
|
3563
|
-
PSMessage.prototype.from = null;
|
|
3564
|
-
|
|
3565
|
-
/**
|
|
3566
|
-
* PSMessage data.
|
|
3567
|
-
* @member {Uint8Array|null|undefined} data
|
|
3568
|
-
* @memberof PSMessage
|
|
3569
|
-
* @instance
|
|
3570
|
-
*/
|
|
3571
|
-
PSMessage.prototype.data = null;
|
|
3572
|
-
|
|
3573
|
-
/**
|
|
3574
|
-
* PSMessage seqno.
|
|
3575
|
-
* @member {Uint8Array|null|undefined} seqno
|
|
3576
|
-
* @memberof PSMessage
|
|
3577
|
-
* @instance
|
|
3578
|
-
*/
|
|
3579
|
-
PSMessage.prototype.seqno = null;
|
|
3580
|
-
|
|
3581
|
-
/**
|
|
3582
|
-
* PSMessage topicIDs.
|
|
3583
|
-
* @member {Array.<string>} topicIDs
|
|
3584
|
-
* @memberof PSMessage
|
|
3585
|
-
* @instance
|
|
3586
|
-
*/
|
|
3587
|
-
PSMessage.prototype.topicIDs = $util.emptyArray;
|
|
3588
|
-
|
|
3589
|
-
/**
|
|
3590
|
-
* PSMessage signature.
|
|
3591
|
-
* @member {Uint8Array|null|undefined} signature
|
|
3592
|
-
* @memberof PSMessage
|
|
3593
|
-
* @instance
|
|
3594
|
-
*/
|
|
3595
|
-
PSMessage.prototype.signature = null;
|
|
3596
|
-
|
|
3597
|
-
/**
|
|
3598
|
-
* PSMessage key.
|
|
3599
|
-
* @member {Uint8Array|null|undefined} key
|
|
3600
|
-
* @memberof PSMessage
|
|
3601
|
-
* @instance
|
|
3602
|
-
*/
|
|
3603
|
-
PSMessage.prototype.key = null;
|
|
3604
|
-
|
|
3605
|
-
// OneOf field names bound to virtual getters and setters
|
|
3606
|
-
let $oneOfFields;
|
|
3607
|
-
|
|
3608
|
-
/**
|
|
3609
|
-
* PSMessage _from.
|
|
3610
|
-
* @member {"from"|undefined} _from
|
|
3611
|
-
* @memberof PSMessage
|
|
3612
|
-
* @instance
|
|
3613
|
-
*/
|
|
3614
|
-
Object.defineProperty(PSMessage.prototype, "_from", {
|
|
3615
|
-
get: $util.oneOfGetter($oneOfFields = ["from"]),
|
|
3616
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
3617
|
-
});
|
|
3618
|
-
|
|
3619
|
-
/**
|
|
3620
|
-
* PSMessage _data.
|
|
3621
|
-
* @member {"data"|undefined} _data
|
|
3622
|
-
* @memberof PSMessage
|
|
3623
|
-
* @instance
|
|
3624
|
-
*/
|
|
3625
|
-
Object.defineProperty(PSMessage.prototype, "_data", {
|
|
3626
|
-
get: $util.oneOfGetter($oneOfFields = ["data"]),
|
|
3627
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
3628
|
-
});
|
|
3629
|
-
|
|
3630
|
-
/**
|
|
3631
|
-
* PSMessage _seqno.
|
|
3632
|
-
* @member {"seqno"|undefined} _seqno
|
|
3633
|
-
* @memberof PSMessage
|
|
3634
|
-
* @instance
|
|
3635
|
-
*/
|
|
3636
|
-
Object.defineProperty(PSMessage.prototype, "_seqno", {
|
|
3637
|
-
get: $util.oneOfGetter($oneOfFields = ["seqno"]),
|
|
3638
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
3639
|
-
});
|
|
3640
|
-
|
|
3641
|
-
/**
|
|
3642
|
-
* PSMessage _signature.
|
|
3643
|
-
* @member {"signature"|undefined} _signature
|
|
3644
|
-
* @memberof PSMessage
|
|
3645
|
-
* @instance
|
|
3646
|
-
*/
|
|
3647
|
-
Object.defineProperty(PSMessage.prototype, "_signature", {
|
|
3648
|
-
get: $util.oneOfGetter($oneOfFields = ["signature"]),
|
|
3649
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
3650
|
-
});
|
|
3651
|
-
|
|
3652
|
-
/**
|
|
3653
|
-
* PSMessage _key.
|
|
3654
|
-
* @member {"key"|undefined} _key
|
|
3655
|
-
* @memberof PSMessage
|
|
3656
|
-
* @instance
|
|
3657
|
-
*/
|
|
3658
|
-
Object.defineProperty(PSMessage.prototype, "_key", {
|
|
3659
|
-
get: $util.oneOfGetter($oneOfFields = ["key"]),
|
|
3660
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
3661
|
-
});
|
|
3662
|
-
|
|
3663
|
-
/**
|
|
3664
|
-
* Encodes the specified PSMessage message. Does not implicitly {@link PSMessage.verify|verify} messages.
|
|
3665
|
-
* @function encode
|
|
3666
|
-
* @memberof PSMessage
|
|
3667
|
-
* @static
|
|
3668
|
-
* @param {IPSMessage} m PSMessage message or plain object to encode
|
|
3669
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
3670
|
-
* @returns {$protobuf.Writer} Writer
|
|
3671
|
-
*/
|
|
3672
|
-
PSMessage.encode = function encode(m, w) {
|
|
3673
|
-
if (!w)
|
|
3674
|
-
w = $Writer.create();
|
|
3675
|
-
if (m.from != null && Object.hasOwnProperty.call(m, "from"))
|
|
3676
|
-
w.uint32(10).bytes(m.from);
|
|
3677
|
-
if (m.data != null && Object.hasOwnProperty.call(m, "data"))
|
|
3678
|
-
w.uint32(18).bytes(m.data);
|
|
3679
|
-
if (m.seqno != null && Object.hasOwnProperty.call(m, "seqno"))
|
|
3680
|
-
w.uint32(26).bytes(m.seqno);
|
|
3681
|
-
if (m.topicIDs != null && m.topicIDs.length) {
|
|
3682
|
-
for (var i = 0; i < m.topicIDs.length; ++i)
|
|
3683
|
-
w.uint32(34).string(m.topicIDs[i]);
|
|
3684
|
-
}
|
|
3685
|
-
if (m.signature != null && Object.hasOwnProperty.call(m, "signature"))
|
|
3686
|
-
w.uint32(42).bytes(m.signature);
|
|
3687
|
-
if (m.key != null && Object.hasOwnProperty.call(m, "key"))
|
|
3688
|
-
w.uint32(50).bytes(m.key);
|
|
3689
|
-
return w;
|
|
3690
|
-
};
|
|
3691
|
-
|
|
3692
|
-
/**
|
|
3693
|
-
* Decodes a PSMessage message from the specified reader or buffer.
|
|
3694
|
-
* @function decode
|
|
3695
|
-
* @memberof PSMessage
|
|
3696
|
-
* @static
|
|
3697
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
3698
|
-
* @param {number} [l] Message length if known beforehand
|
|
3699
|
-
* @returns {PSMessage} PSMessage
|
|
3700
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
3701
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
3702
|
-
*/
|
|
3703
|
-
PSMessage.decode = function decode(r, l) {
|
|
3704
|
-
if (!(r instanceof $Reader))
|
|
3705
|
-
r = $Reader.create(r);
|
|
3706
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.PSMessage();
|
|
3707
|
-
while (r.pos < c) {
|
|
3708
|
-
var t = r.uint32();
|
|
3709
|
-
switch (t >>> 3) {
|
|
3710
|
-
case 1:
|
|
3711
|
-
m.from = r.bytes();
|
|
3712
|
-
break;
|
|
3713
|
-
case 2:
|
|
3714
|
-
m.data = r.bytes();
|
|
3715
|
-
break;
|
|
3716
|
-
case 3:
|
|
3717
|
-
m.seqno = r.bytes();
|
|
3718
|
-
break;
|
|
3719
|
-
case 4:
|
|
3720
|
-
if (!(m.topicIDs && m.topicIDs.length))
|
|
3721
|
-
m.topicIDs = [];
|
|
3722
|
-
m.topicIDs.push(r.string());
|
|
3723
|
-
break;
|
|
3724
|
-
case 5:
|
|
3725
|
-
m.signature = r.bytes();
|
|
3726
|
-
break;
|
|
3727
|
-
case 6:
|
|
3728
|
-
m.key = r.bytes();
|
|
3729
|
-
break;
|
|
3730
|
-
default:
|
|
3731
|
-
r.skipType(t & 7);
|
|
3732
|
-
break;
|
|
3733
|
-
}
|
|
3734
|
-
}
|
|
3735
|
-
return m;
|
|
3736
|
-
};
|
|
3737
|
-
|
|
3738
|
-
/**
|
|
3739
|
-
* Creates a PSMessage message from a plain object. Also converts values to their respective internal types.
|
|
3740
|
-
* @function fromObject
|
|
3741
|
-
* @memberof PSMessage
|
|
3742
|
-
* @static
|
|
3743
|
-
* @param {Object.<string,*>} d Plain object
|
|
3744
|
-
* @returns {PSMessage} PSMessage
|
|
3745
|
-
*/
|
|
3746
|
-
PSMessage.fromObject = function fromObject(d) {
|
|
3747
|
-
if (d instanceof $root.PSMessage)
|
|
3748
|
-
return d;
|
|
3749
|
-
var m = new $root.PSMessage();
|
|
3750
|
-
if (d.from != null) {
|
|
3751
|
-
if (typeof d.from === "string")
|
|
3752
|
-
$util.base64.decode(d.from, m.from = $util.newBuffer($util.base64.length(d.from)), 0);
|
|
3753
|
-
else if (d.from.length)
|
|
3754
|
-
m.from = d.from;
|
|
3755
|
-
}
|
|
3756
|
-
if (d.data != null) {
|
|
3757
|
-
if (typeof d.data === "string")
|
|
3758
|
-
$util.base64.decode(d.data, m.data = $util.newBuffer($util.base64.length(d.data)), 0);
|
|
3759
|
-
else if (d.data.length)
|
|
3760
|
-
m.data = d.data;
|
|
3761
|
-
}
|
|
3762
|
-
if (d.seqno != null) {
|
|
3763
|
-
if (typeof d.seqno === "string")
|
|
3764
|
-
$util.base64.decode(d.seqno, m.seqno = $util.newBuffer($util.base64.length(d.seqno)), 0);
|
|
3765
|
-
else if (d.seqno.length)
|
|
3766
|
-
m.seqno = d.seqno;
|
|
3767
|
-
}
|
|
3768
|
-
if (d.topicIDs) {
|
|
3769
|
-
if (!Array.isArray(d.topicIDs))
|
|
3770
|
-
throw TypeError(".PSMessage.topicIDs: array expected");
|
|
3771
|
-
m.topicIDs = [];
|
|
3772
|
-
for (var i = 0; i < d.topicIDs.length; ++i) {
|
|
3773
|
-
m.topicIDs[i] = String(d.topicIDs[i]);
|
|
3774
|
-
}
|
|
3775
|
-
}
|
|
3776
|
-
if (d.signature != null) {
|
|
3777
|
-
if (typeof d.signature === "string")
|
|
3778
|
-
$util.base64.decode(d.signature, m.signature = $util.newBuffer($util.base64.length(d.signature)), 0);
|
|
3779
|
-
else if (d.signature.length)
|
|
3780
|
-
m.signature = d.signature;
|
|
3781
|
-
}
|
|
3782
|
-
if (d.key != null) {
|
|
3783
|
-
if (typeof d.key === "string")
|
|
3784
|
-
$util.base64.decode(d.key, m.key = $util.newBuffer($util.base64.length(d.key)), 0);
|
|
3785
|
-
else if (d.key.length)
|
|
3786
|
-
m.key = d.key;
|
|
3787
|
-
}
|
|
3788
|
-
return m;
|
|
3789
|
-
};
|
|
3790
|
-
|
|
3791
|
-
/**
|
|
3792
|
-
* Creates a plain object from a PSMessage message. Also converts values to other types if specified.
|
|
3793
|
-
* @function toObject
|
|
3794
|
-
* @memberof PSMessage
|
|
3795
|
-
* @static
|
|
3796
|
-
* @param {PSMessage} m PSMessage
|
|
3797
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
3798
|
-
* @returns {Object.<string,*>} Plain object
|
|
3799
|
-
*/
|
|
3800
|
-
PSMessage.toObject = function toObject(m, o) {
|
|
3801
|
-
if (!o)
|
|
3802
|
-
o = {};
|
|
3803
|
-
var d = {};
|
|
3804
|
-
if (o.arrays || o.defaults) {
|
|
3805
|
-
d.topicIDs = [];
|
|
3806
|
-
}
|
|
3807
|
-
if (m.from != null && m.hasOwnProperty("from")) {
|
|
3808
|
-
d.from = o.bytes === String ? $util.base64.encode(m.from, 0, m.from.length) : o.bytes === Array ? Array.prototype.slice.call(m.from) : m.from;
|
|
3809
|
-
if (o.oneofs)
|
|
3810
|
-
d._from = "from";
|
|
3811
|
-
}
|
|
3812
|
-
if (m.data != null && m.hasOwnProperty("data")) {
|
|
3813
|
-
d.data = o.bytes === String ? $util.base64.encode(m.data, 0, m.data.length) : o.bytes === Array ? Array.prototype.slice.call(m.data) : m.data;
|
|
3814
|
-
if (o.oneofs)
|
|
3815
|
-
d._data = "data";
|
|
3816
|
-
}
|
|
3817
|
-
if (m.seqno != null && m.hasOwnProperty("seqno")) {
|
|
3818
|
-
d.seqno = o.bytes === String ? $util.base64.encode(m.seqno, 0, m.seqno.length) : o.bytes === Array ? Array.prototype.slice.call(m.seqno) : m.seqno;
|
|
3819
|
-
if (o.oneofs)
|
|
3820
|
-
d._seqno = "seqno";
|
|
3821
|
-
}
|
|
3822
|
-
if (m.topicIDs && m.topicIDs.length) {
|
|
3823
|
-
d.topicIDs = [];
|
|
3824
|
-
for (var j = 0; j < m.topicIDs.length; ++j) {
|
|
3825
|
-
d.topicIDs[j] = m.topicIDs[j];
|
|
3826
|
-
}
|
|
3827
|
-
}
|
|
3828
|
-
if (m.signature != null && m.hasOwnProperty("signature")) {
|
|
3829
|
-
d.signature = o.bytes === String ? $util.base64.encode(m.signature, 0, m.signature.length) : o.bytes === Array ? Array.prototype.slice.call(m.signature) : m.signature;
|
|
3830
|
-
if (o.oneofs)
|
|
3831
|
-
d._signature = "signature";
|
|
3832
|
-
}
|
|
3833
|
-
if (m.key != null && m.hasOwnProperty("key")) {
|
|
3834
|
-
d.key = o.bytes === String ? $util.base64.encode(m.key, 0, m.key.length) : o.bytes === Array ? Array.prototype.slice.call(m.key) : m.key;
|
|
3835
|
-
if (o.oneofs)
|
|
3836
|
-
d._key = "key";
|
|
3837
|
-
}
|
|
3838
|
-
return d;
|
|
3839
|
-
};
|
|
3840
|
-
|
|
3841
|
-
/**
|
|
3842
|
-
* Converts this PSMessage to JSON.
|
|
3843
|
-
* @function toJSON
|
|
3844
|
-
* @memberof PSMessage
|
|
3845
|
-
* @instance
|
|
3846
|
-
* @returns {Object.<string,*>} JSON object
|
|
3847
|
-
*/
|
|
3848
|
-
PSMessage.prototype.toJSON = function toJSON() {
|
|
3849
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
3850
|
-
};
|
|
3851
|
-
|
|
3852
|
-
return PSMessage;
|
|
3853
|
-
})();
|
|
3854
|
-
|
|
3855
|
-
export const PSResponse = $root.PSResponse = (() => {
|
|
3856
|
-
|
|
3857
|
-
/**
|
|
3858
|
-
* Properties of a PSResponse.
|
|
3859
|
-
* @exports IPSResponse
|
|
3860
|
-
* @interface IPSResponse
|
|
3861
|
-
* @property {Array.<string>|null} [topics] PSResponse topics
|
|
3862
|
-
* @property {Array.<Uint8Array>|null} [peerIDs] PSResponse peerIDs
|
|
3863
|
-
*/
|
|
3864
|
-
|
|
3865
|
-
/**
|
|
3866
|
-
* Constructs a new PSResponse.
|
|
3867
|
-
* @exports PSResponse
|
|
3868
|
-
* @classdesc Represents a PSResponse.
|
|
3869
|
-
* @implements IPSResponse
|
|
3870
|
-
* @constructor
|
|
3871
|
-
* @param {IPSResponse=} [p] Properties to set
|
|
3872
|
-
*/
|
|
3873
|
-
function PSResponse(p) {
|
|
3874
|
-
this.topics = [];
|
|
3875
|
-
this.peerIDs = [];
|
|
3876
|
-
if (p)
|
|
3877
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
3878
|
-
if (p[ks[i]] != null)
|
|
3879
|
-
this[ks[i]] = p[ks[i]];
|
|
3880
|
-
}
|
|
3881
|
-
|
|
3882
|
-
/**
|
|
3883
|
-
* PSResponse topics.
|
|
3884
|
-
* @member {Array.<string>} topics
|
|
3885
|
-
* @memberof PSResponse
|
|
3886
|
-
* @instance
|
|
3887
|
-
*/
|
|
3888
|
-
PSResponse.prototype.topics = $util.emptyArray;
|
|
3889
|
-
|
|
3890
|
-
/**
|
|
3891
|
-
* PSResponse peerIDs.
|
|
3892
|
-
* @member {Array.<Uint8Array>} peerIDs
|
|
3893
|
-
* @memberof PSResponse
|
|
3894
|
-
* @instance
|
|
3895
|
-
*/
|
|
3896
|
-
PSResponse.prototype.peerIDs = $util.emptyArray;
|
|
3897
|
-
|
|
3898
|
-
/**
|
|
3899
|
-
* Encodes the specified PSResponse message. Does not implicitly {@link PSResponse.verify|verify} messages.
|
|
3900
|
-
* @function encode
|
|
3901
|
-
* @memberof PSResponse
|
|
3902
|
-
* @static
|
|
3903
|
-
* @param {IPSResponse} m PSResponse message or plain object to encode
|
|
3904
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
3905
|
-
* @returns {$protobuf.Writer} Writer
|
|
3906
|
-
*/
|
|
3907
|
-
PSResponse.encode = function encode(m, w) {
|
|
3908
|
-
if (!w)
|
|
3909
|
-
w = $Writer.create();
|
|
3910
|
-
if (m.topics != null && m.topics.length) {
|
|
3911
|
-
for (var i = 0; i < m.topics.length; ++i)
|
|
3912
|
-
w.uint32(10).string(m.topics[i]);
|
|
3913
|
-
}
|
|
3914
|
-
if (m.peerIDs != null && m.peerIDs.length) {
|
|
3915
|
-
for (var i = 0; i < m.peerIDs.length; ++i)
|
|
3916
|
-
w.uint32(18).bytes(m.peerIDs[i]);
|
|
3917
|
-
}
|
|
3918
|
-
return w;
|
|
3919
|
-
};
|
|
3920
|
-
|
|
3921
|
-
/**
|
|
3922
|
-
* Decodes a PSResponse message from the specified reader or buffer.
|
|
3923
|
-
* @function decode
|
|
3924
|
-
* @memberof PSResponse
|
|
3925
|
-
* @static
|
|
3926
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
3927
|
-
* @param {number} [l] Message length if known beforehand
|
|
3928
|
-
* @returns {PSResponse} PSResponse
|
|
3929
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
3930
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
3931
|
-
*/
|
|
3932
|
-
PSResponse.decode = function decode(r, l) {
|
|
3933
|
-
if (!(r instanceof $Reader))
|
|
3934
|
-
r = $Reader.create(r);
|
|
3935
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.PSResponse();
|
|
3936
|
-
while (r.pos < c) {
|
|
3937
|
-
var t = r.uint32();
|
|
3938
|
-
switch (t >>> 3) {
|
|
3939
|
-
case 1:
|
|
3940
|
-
if (!(m.topics && m.topics.length))
|
|
3941
|
-
m.topics = [];
|
|
3942
|
-
m.topics.push(r.string());
|
|
3943
|
-
break;
|
|
3944
|
-
case 2:
|
|
3945
|
-
if (!(m.peerIDs && m.peerIDs.length))
|
|
3946
|
-
m.peerIDs = [];
|
|
3947
|
-
m.peerIDs.push(r.bytes());
|
|
3948
|
-
break;
|
|
3949
|
-
default:
|
|
3950
|
-
r.skipType(t & 7);
|
|
3951
|
-
break;
|
|
3952
|
-
}
|
|
3953
|
-
}
|
|
3954
|
-
return m;
|
|
3955
|
-
};
|
|
3956
|
-
|
|
3957
|
-
/**
|
|
3958
|
-
* Creates a PSResponse message from a plain object. Also converts values to their respective internal types.
|
|
3959
|
-
* @function fromObject
|
|
3960
|
-
* @memberof PSResponse
|
|
3961
|
-
* @static
|
|
3962
|
-
* @param {Object.<string,*>} d Plain object
|
|
3963
|
-
* @returns {PSResponse} PSResponse
|
|
3964
|
-
*/
|
|
3965
|
-
PSResponse.fromObject = function fromObject(d) {
|
|
3966
|
-
if (d instanceof $root.PSResponse)
|
|
3967
|
-
return d;
|
|
3968
|
-
var m = new $root.PSResponse();
|
|
3969
|
-
if (d.topics) {
|
|
3970
|
-
if (!Array.isArray(d.topics))
|
|
3971
|
-
throw TypeError(".PSResponse.topics: array expected");
|
|
3972
|
-
m.topics = [];
|
|
3973
|
-
for (var i = 0; i < d.topics.length; ++i) {
|
|
3974
|
-
m.topics[i] = String(d.topics[i]);
|
|
3975
|
-
}
|
|
3976
|
-
}
|
|
3977
|
-
if (d.peerIDs) {
|
|
3978
|
-
if (!Array.isArray(d.peerIDs))
|
|
3979
|
-
throw TypeError(".PSResponse.peerIDs: array expected");
|
|
3980
|
-
m.peerIDs = [];
|
|
3981
|
-
for (var i = 0; i < d.peerIDs.length; ++i) {
|
|
3982
|
-
if (typeof d.peerIDs[i] === "string")
|
|
3983
|
-
$util.base64.decode(d.peerIDs[i], m.peerIDs[i] = $util.newBuffer($util.base64.length(d.peerIDs[i])), 0);
|
|
3984
|
-
else if (d.peerIDs[i].length)
|
|
3985
|
-
m.peerIDs[i] = d.peerIDs[i];
|
|
3986
|
-
}
|
|
3987
|
-
}
|
|
3988
|
-
return m;
|
|
3989
|
-
};
|
|
3990
|
-
|
|
3991
|
-
/**
|
|
3992
|
-
* Creates a plain object from a PSResponse message. Also converts values to other types if specified.
|
|
3993
|
-
* @function toObject
|
|
3994
|
-
* @memberof PSResponse
|
|
3995
|
-
* @static
|
|
3996
|
-
* @param {PSResponse} m PSResponse
|
|
3997
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
3998
|
-
* @returns {Object.<string,*>} Plain object
|
|
3999
|
-
*/
|
|
4000
|
-
PSResponse.toObject = function toObject(m, o) {
|
|
4001
|
-
if (!o)
|
|
4002
|
-
o = {};
|
|
4003
|
-
var d = {};
|
|
4004
|
-
if (o.arrays || o.defaults) {
|
|
4005
|
-
d.topics = [];
|
|
4006
|
-
d.peerIDs = [];
|
|
4007
|
-
}
|
|
4008
|
-
if (m.topics && m.topics.length) {
|
|
4009
|
-
d.topics = [];
|
|
4010
|
-
for (var j = 0; j < m.topics.length; ++j) {
|
|
4011
|
-
d.topics[j] = m.topics[j];
|
|
4012
|
-
}
|
|
4013
|
-
}
|
|
4014
|
-
if (m.peerIDs && m.peerIDs.length) {
|
|
4015
|
-
d.peerIDs = [];
|
|
4016
|
-
for (var j = 0; j < m.peerIDs.length; ++j) {
|
|
4017
|
-
d.peerIDs[j] = o.bytes === String ? $util.base64.encode(m.peerIDs[j], 0, m.peerIDs[j].length) : o.bytes === Array ? Array.prototype.slice.call(m.peerIDs[j]) : m.peerIDs[j];
|
|
4018
|
-
}
|
|
4019
|
-
}
|
|
4020
|
-
return d;
|
|
4021
|
-
};
|
|
4022
|
-
|
|
4023
|
-
/**
|
|
4024
|
-
* Converts this PSResponse to JSON.
|
|
4025
|
-
* @function toJSON
|
|
4026
|
-
* @memberof PSResponse
|
|
4027
|
-
* @instance
|
|
4028
|
-
* @returns {Object.<string,*>} JSON object
|
|
4029
|
-
*/
|
|
4030
|
-
PSResponse.prototype.toJSON = function toJSON() {
|
|
4031
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
4032
|
-
};
|
|
4033
|
-
|
|
4034
|
-
return PSResponse;
|
|
4035
|
-
})();
|
|
4036
|
-
|
|
4037
|
-
export const PeerstoreRequest = $root.PeerstoreRequest = (() => {
|
|
4038
|
-
|
|
4039
|
-
/**
|
|
4040
|
-
* Properties of a PeerstoreRequest.
|
|
4041
|
-
* @exports IPeerstoreRequest
|
|
4042
|
-
* @interface IPeerstoreRequest
|
|
4043
|
-
* @property {PeerstoreRequest.Type} type PeerstoreRequest type
|
|
4044
|
-
* @property {Uint8Array|null} [id] PeerstoreRequest id
|
|
4045
|
-
* @property {Array.<string>|null} [protos] PeerstoreRequest protos
|
|
4046
|
-
*/
|
|
4047
|
-
|
|
4048
|
-
/**
|
|
4049
|
-
* Constructs a new PeerstoreRequest.
|
|
4050
|
-
* @exports PeerstoreRequest
|
|
4051
|
-
* @classdesc Represents a PeerstoreRequest.
|
|
4052
|
-
* @implements IPeerstoreRequest
|
|
4053
|
-
* @constructor
|
|
4054
|
-
* @param {IPeerstoreRequest=} [p] Properties to set
|
|
4055
|
-
*/
|
|
4056
|
-
function PeerstoreRequest(p) {
|
|
4057
|
-
this.protos = [];
|
|
4058
|
-
if (p)
|
|
4059
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
4060
|
-
if (p[ks[i]] != null)
|
|
4061
|
-
this[ks[i]] = p[ks[i]];
|
|
4062
|
-
}
|
|
4063
|
-
|
|
4064
|
-
/**
|
|
4065
|
-
* PeerstoreRequest type.
|
|
4066
|
-
* @member {PeerstoreRequest.Type} type
|
|
4067
|
-
* @memberof PeerstoreRequest
|
|
4068
|
-
* @instance
|
|
4069
|
-
*/
|
|
4070
|
-
PeerstoreRequest.prototype.type = 1;
|
|
4071
|
-
|
|
4072
|
-
/**
|
|
4073
|
-
* PeerstoreRequest id.
|
|
4074
|
-
* @member {Uint8Array|null|undefined} id
|
|
4075
|
-
* @memberof PeerstoreRequest
|
|
4076
|
-
* @instance
|
|
4077
|
-
*/
|
|
4078
|
-
PeerstoreRequest.prototype.id = null;
|
|
4079
|
-
|
|
4080
|
-
/**
|
|
4081
|
-
* PeerstoreRequest protos.
|
|
4082
|
-
* @member {Array.<string>} protos
|
|
4083
|
-
* @memberof PeerstoreRequest
|
|
4084
|
-
* @instance
|
|
4085
|
-
*/
|
|
4086
|
-
PeerstoreRequest.prototype.protos = $util.emptyArray;
|
|
4087
|
-
|
|
4088
|
-
// OneOf field names bound to virtual getters and setters
|
|
4089
|
-
let $oneOfFields;
|
|
4090
|
-
|
|
4091
|
-
/**
|
|
4092
|
-
* PeerstoreRequest _id.
|
|
4093
|
-
* @member {"id"|undefined} _id
|
|
4094
|
-
* @memberof PeerstoreRequest
|
|
4095
|
-
* @instance
|
|
4096
|
-
*/
|
|
4097
|
-
Object.defineProperty(PeerstoreRequest.prototype, "_id", {
|
|
4098
|
-
get: $util.oneOfGetter($oneOfFields = ["id"]),
|
|
4099
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
4100
|
-
});
|
|
4101
|
-
|
|
4102
|
-
/**
|
|
4103
|
-
* Encodes the specified PeerstoreRequest message. Does not implicitly {@link PeerstoreRequest.verify|verify} messages.
|
|
4104
|
-
* @function encode
|
|
4105
|
-
* @memberof PeerstoreRequest
|
|
4106
|
-
* @static
|
|
4107
|
-
* @param {IPeerstoreRequest} m PeerstoreRequest message or plain object to encode
|
|
4108
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
4109
|
-
* @returns {$protobuf.Writer} Writer
|
|
4110
|
-
*/
|
|
4111
|
-
PeerstoreRequest.encode = function encode(m, w) {
|
|
4112
|
-
if (!w)
|
|
4113
|
-
w = $Writer.create();
|
|
4114
|
-
w.uint32(8).int32(m.type);
|
|
4115
|
-
if (m.id != null && Object.hasOwnProperty.call(m, "id"))
|
|
4116
|
-
w.uint32(18).bytes(m.id);
|
|
4117
|
-
if (m.protos != null && m.protos.length) {
|
|
4118
|
-
for (var i = 0; i < m.protos.length; ++i)
|
|
4119
|
-
w.uint32(26).string(m.protos[i]);
|
|
4120
|
-
}
|
|
4121
|
-
return w;
|
|
4122
|
-
};
|
|
4123
|
-
|
|
4124
|
-
/**
|
|
4125
|
-
* Decodes a PeerstoreRequest message from the specified reader or buffer.
|
|
4126
|
-
* @function decode
|
|
4127
|
-
* @memberof PeerstoreRequest
|
|
4128
|
-
* @static
|
|
4129
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
4130
|
-
* @param {number} [l] Message length if known beforehand
|
|
4131
|
-
* @returns {PeerstoreRequest} PeerstoreRequest
|
|
4132
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
4133
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
4134
|
-
*/
|
|
4135
|
-
PeerstoreRequest.decode = function decode(r, l) {
|
|
4136
|
-
if (!(r instanceof $Reader))
|
|
4137
|
-
r = $Reader.create(r);
|
|
4138
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.PeerstoreRequest();
|
|
4139
|
-
while (r.pos < c) {
|
|
4140
|
-
var t = r.uint32();
|
|
4141
|
-
switch (t >>> 3) {
|
|
4142
|
-
case 1:
|
|
4143
|
-
m.type = r.int32();
|
|
4144
|
-
break;
|
|
4145
|
-
case 2:
|
|
4146
|
-
m.id = r.bytes();
|
|
4147
|
-
break;
|
|
4148
|
-
case 3:
|
|
4149
|
-
if (!(m.protos && m.protos.length))
|
|
4150
|
-
m.protos = [];
|
|
4151
|
-
m.protos.push(r.string());
|
|
4152
|
-
break;
|
|
4153
|
-
default:
|
|
4154
|
-
r.skipType(t & 7);
|
|
4155
|
-
break;
|
|
4156
|
-
}
|
|
4157
|
-
}
|
|
4158
|
-
if (!m.hasOwnProperty("type"))
|
|
4159
|
-
throw $util.ProtocolError("missing required 'type'", { instance: m });
|
|
4160
|
-
return m;
|
|
4161
|
-
};
|
|
4162
|
-
|
|
4163
|
-
/**
|
|
4164
|
-
* Creates a PeerstoreRequest message from a plain object. Also converts values to their respective internal types.
|
|
4165
|
-
* @function fromObject
|
|
4166
|
-
* @memberof PeerstoreRequest
|
|
4167
|
-
* @static
|
|
4168
|
-
* @param {Object.<string,*>} d Plain object
|
|
4169
|
-
* @returns {PeerstoreRequest} PeerstoreRequest
|
|
4170
|
-
*/
|
|
4171
|
-
PeerstoreRequest.fromObject = function fromObject(d) {
|
|
4172
|
-
if (d instanceof $root.PeerstoreRequest)
|
|
4173
|
-
return d;
|
|
4174
|
-
var m = new $root.PeerstoreRequest();
|
|
4175
|
-
switch (d.type) {
|
|
4176
|
-
case "GET_PROTOCOLS":
|
|
4177
|
-
case 1:
|
|
4178
|
-
m.type = 1;
|
|
4179
|
-
break;
|
|
4180
|
-
case "GET_PEER_INFO":
|
|
4181
|
-
case 2:
|
|
4182
|
-
m.type = 2;
|
|
4183
|
-
break;
|
|
4184
|
-
}
|
|
4185
|
-
if (d.id != null) {
|
|
4186
|
-
if (typeof d.id === "string")
|
|
4187
|
-
$util.base64.decode(d.id, m.id = $util.newBuffer($util.base64.length(d.id)), 0);
|
|
4188
|
-
else if (d.id.length)
|
|
4189
|
-
m.id = d.id;
|
|
4190
|
-
}
|
|
4191
|
-
if (d.protos) {
|
|
4192
|
-
if (!Array.isArray(d.protos))
|
|
4193
|
-
throw TypeError(".PeerstoreRequest.protos: array expected");
|
|
4194
|
-
m.protos = [];
|
|
4195
|
-
for (var i = 0; i < d.protos.length; ++i) {
|
|
4196
|
-
m.protos[i] = String(d.protos[i]);
|
|
4197
|
-
}
|
|
4198
|
-
}
|
|
4199
|
-
return m;
|
|
4200
|
-
};
|
|
4201
|
-
|
|
4202
|
-
/**
|
|
4203
|
-
* Creates a plain object from a PeerstoreRequest message. Also converts values to other types if specified.
|
|
4204
|
-
* @function toObject
|
|
4205
|
-
* @memberof PeerstoreRequest
|
|
4206
|
-
* @static
|
|
4207
|
-
* @param {PeerstoreRequest} m PeerstoreRequest
|
|
4208
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
4209
|
-
* @returns {Object.<string,*>} Plain object
|
|
4210
|
-
*/
|
|
4211
|
-
PeerstoreRequest.toObject = function toObject(m, o) {
|
|
4212
|
-
if (!o)
|
|
4213
|
-
o = {};
|
|
4214
|
-
var d = {};
|
|
4215
|
-
if (o.arrays || o.defaults) {
|
|
4216
|
-
d.protos = [];
|
|
4217
|
-
}
|
|
4218
|
-
if (o.defaults) {
|
|
4219
|
-
d.type = o.enums === String ? "GET_PROTOCOLS" : 1;
|
|
4220
|
-
}
|
|
4221
|
-
if (m.type != null && m.hasOwnProperty("type")) {
|
|
4222
|
-
d.type = o.enums === String ? $root.PeerstoreRequest.Type[m.type] : m.type;
|
|
4223
|
-
}
|
|
4224
|
-
if (m.id != null && m.hasOwnProperty("id")) {
|
|
4225
|
-
d.id = o.bytes === String ? $util.base64.encode(m.id, 0, m.id.length) : o.bytes === Array ? Array.prototype.slice.call(m.id) : m.id;
|
|
4226
|
-
if (o.oneofs)
|
|
4227
|
-
d._id = "id";
|
|
4228
|
-
}
|
|
4229
|
-
if (m.protos && m.protos.length) {
|
|
4230
|
-
d.protos = [];
|
|
4231
|
-
for (var j = 0; j < m.protos.length; ++j) {
|
|
4232
|
-
d.protos[j] = m.protos[j];
|
|
4233
|
-
}
|
|
4234
|
-
}
|
|
4235
|
-
return d;
|
|
4236
|
-
};
|
|
4237
|
-
|
|
4238
|
-
/**
|
|
4239
|
-
* Converts this PeerstoreRequest to JSON.
|
|
4240
|
-
* @function toJSON
|
|
4241
|
-
* @memberof PeerstoreRequest
|
|
4242
|
-
* @instance
|
|
4243
|
-
* @returns {Object.<string,*>} JSON object
|
|
4244
|
-
*/
|
|
4245
|
-
PeerstoreRequest.prototype.toJSON = function toJSON() {
|
|
4246
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
4247
|
-
};
|
|
4248
|
-
|
|
4249
|
-
/**
|
|
4250
|
-
* Type enum.
|
|
4251
|
-
* @name PeerstoreRequest.Type
|
|
4252
|
-
* @enum {number}
|
|
4253
|
-
* @property {number} GET_PROTOCOLS=1 GET_PROTOCOLS value
|
|
4254
|
-
* @property {number} GET_PEER_INFO=2 GET_PEER_INFO value
|
|
4255
|
-
*/
|
|
4256
|
-
PeerstoreRequest.Type = (function() {
|
|
4257
|
-
const valuesById = {}, values = Object.create(valuesById);
|
|
4258
|
-
values[valuesById[1] = "GET_PROTOCOLS"] = 1;
|
|
4259
|
-
values[valuesById[2] = "GET_PEER_INFO"] = 2;
|
|
4260
|
-
return values;
|
|
4261
|
-
})();
|
|
4262
|
-
|
|
4263
|
-
return PeerstoreRequest;
|
|
4264
|
-
})();
|
|
4265
|
-
|
|
4266
|
-
export const PeerstoreResponse = $root.PeerstoreResponse = (() => {
|
|
4267
|
-
|
|
4268
|
-
/**
|
|
4269
|
-
* Properties of a PeerstoreResponse.
|
|
4270
|
-
* @exports IPeerstoreResponse
|
|
4271
|
-
* @interface IPeerstoreResponse
|
|
4272
|
-
* @property {IPeerInfo|null} [peer] PeerstoreResponse peer
|
|
4273
|
-
* @property {Array.<string>|null} [protos] PeerstoreResponse protos
|
|
4274
|
-
*/
|
|
4275
|
-
|
|
4276
|
-
/**
|
|
4277
|
-
* Constructs a new PeerstoreResponse.
|
|
4278
|
-
* @exports PeerstoreResponse
|
|
4279
|
-
* @classdesc Represents a PeerstoreResponse.
|
|
4280
|
-
* @implements IPeerstoreResponse
|
|
4281
|
-
* @constructor
|
|
4282
|
-
* @param {IPeerstoreResponse=} [p] Properties to set
|
|
4283
|
-
*/
|
|
4284
|
-
function PeerstoreResponse(p) {
|
|
4285
|
-
this.protos = [];
|
|
4286
|
-
if (p)
|
|
4287
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
4288
|
-
if (p[ks[i]] != null)
|
|
4289
|
-
this[ks[i]] = p[ks[i]];
|
|
4290
|
-
}
|
|
4291
|
-
|
|
4292
|
-
/**
|
|
4293
|
-
* PeerstoreResponse peer.
|
|
4294
|
-
* @member {IPeerInfo|null|undefined} peer
|
|
4295
|
-
* @memberof PeerstoreResponse
|
|
4296
|
-
* @instance
|
|
4297
|
-
*/
|
|
4298
|
-
PeerstoreResponse.prototype.peer = null;
|
|
4299
|
-
|
|
4300
|
-
/**
|
|
4301
|
-
* PeerstoreResponse protos.
|
|
4302
|
-
* @member {Array.<string>} protos
|
|
4303
|
-
* @memberof PeerstoreResponse
|
|
4304
|
-
* @instance
|
|
4305
|
-
*/
|
|
4306
|
-
PeerstoreResponse.prototype.protos = $util.emptyArray;
|
|
4307
|
-
|
|
4308
|
-
// OneOf field names bound to virtual getters and setters
|
|
4309
|
-
let $oneOfFields;
|
|
4310
|
-
|
|
4311
|
-
/**
|
|
4312
|
-
* PeerstoreResponse _peer.
|
|
4313
|
-
* @member {"peer"|undefined} _peer
|
|
4314
|
-
* @memberof PeerstoreResponse
|
|
4315
|
-
* @instance
|
|
4316
|
-
*/
|
|
4317
|
-
Object.defineProperty(PeerstoreResponse.prototype, "_peer", {
|
|
4318
|
-
get: $util.oneOfGetter($oneOfFields = ["peer"]),
|
|
4319
|
-
set: $util.oneOfSetter($oneOfFields)
|
|
4320
|
-
});
|
|
4321
|
-
|
|
4322
|
-
/**
|
|
4323
|
-
* Encodes the specified PeerstoreResponse message. Does not implicitly {@link PeerstoreResponse.verify|verify} messages.
|
|
4324
|
-
* @function encode
|
|
4325
|
-
* @memberof PeerstoreResponse
|
|
4326
|
-
* @static
|
|
4327
|
-
* @param {IPeerstoreResponse} m PeerstoreResponse message or plain object to encode
|
|
4328
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
4329
|
-
* @returns {$protobuf.Writer} Writer
|
|
4330
|
-
*/
|
|
4331
|
-
PeerstoreResponse.encode = function encode(m, w) {
|
|
4332
|
-
if (!w)
|
|
4333
|
-
w = $Writer.create();
|
|
4334
|
-
if (m.peer != null && Object.hasOwnProperty.call(m, "peer"))
|
|
4335
|
-
$root.PeerInfo.encode(m.peer, w.uint32(10).fork()).ldelim();
|
|
4336
|
-
if (m.protos != null && m.protos.length) {
|
|
4337
|
-
for (var i = 0; i < m.protos.length; ++i)
|
|
4338
|
-
w.uint32(18).string(m.protos[i]);
|
|
4339
|
-
}
|
|
4340
|
-
return w;
|
|
4341
|
-
};
|
|
4342
|
-
|
|
4343
|
-
/**
|
|
4344
|
-
* Decodes a PeerstoreResponse message from the specified reader or buffer.
|
|
4345
|
-
* @function decode
|
|
4346
|
-
* @memberof PeerstoreResponse
|
|
4347
|
-
* @static
|
|
4348
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
4349
|
-
* @param {number} [l] Message length if known beforehand
|
|
4350
|
-
* @returns {PeerstoreResponse} PeerstoreResponse
|
|
4351
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
4352
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
4353
|
-
*/
|
|
4354
|
-
PeerstoreResponse.decode = function decode(r, l) {
|
|
4355
|
-
if (!(r instanceof $Reader))
|
|
4356
|
-
r = $Reader.create(r);
|
|
4357
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.PeerstoreResponse();
|
|
4358
|
-
while (r.pos < c) {
|
|
4359
|
-
var t = r.uint32();
|
|
4360
|
-
switch (t >>> 3) {
|
|
4361
|
-
case 1:
|
|
4362
|
-
m.peer = $root.PeerInfo.decode(r, r.uint32());
|
|
4363
|
-
break;
|
|
4364
|
-
case 2:
|
|
4365
|
-
if (!(m.protos && m.protos.length))
|
|
4366
|
-
m.protos = [];
|
|
4367
|
-
m.protos.push(r.string());
|
|
4368
|
-
break;
|
|
4369
|
-
default:
|
|
4370
|
-
r.skipType(t & 7);
|
|
4371
|
-
break;
|
|
4372
|
-
}
|
|
4373
|
-
}
|
|
4374
|
-
return m;
|
|
4375
|
-
};
|
|
4376
|
-
|
|
4377
|
-
/**
|
|
4378
|
-
* Creates a PeerstoreResponse message from a plain object. Also converts values to their respective internal types.
|
|
4379
|
-
* @function fromObject
|
|
4380
|
-
* @memberof PeerstoreResponse
|
|
4381
|
-
* @static
|
|
4382
|
-
* @param {Object.<string,*>} d Plain object
|
|
4383
|
-
* @returns {PeerstoreResponse} PeerstoreResponse
|
|
4384
|
-
*/
|
|
4385
|
-
PeerstoreResponse.fromObject = function fromObject(d) {
|
|
4386
|
-
if (d instanceof $root.PeerstoreResponse)
|
|
4387
|
-
return d;
|
|
4388
|
-
var m = new $root.PeerstoreResponse();
|
|
4389
|
-
if (d.peer != null) {
|
|
4390
|
-
if (typeof d.peer !== "object")
|
|
4391
|
-
throw TypeError(".PeerstoreResponse.peer: object expected");
|
|
4392
|
-
m.peer = $root.PeerInfo.fromObject(d.peer);
|
|
4393
|
-
}
|
|
4394
|
-
if (d.protos) {
|
|
4395
|
-
if (!Array.isArray(d.protos))
|
|
4396
|
-
throw TypeError(".PeerstoreResponse.protos: array expected");
|
|
4397
|
-
m.protos = [];
|
|
4398
|
-
for (var i = 0; i < d.protos.length; ++i) {
|
|
4399
|
-
m.protos[i] = String(d.protos[i]);
|
|
4400
|
-
}
|
|
4401
|
-
}
|
|
4402
|
-
return m;
|
|
4403
|
-
};
|
|
4404
|
-
|
|
4405
|
-
/**
|
|
4406
|
-
* Creates a plain object from a PeerstoreResponse message. Also converts values to other types if specified.
|
|
4407
|
-
* @function toObject
|
|
4408
|
-
* @memberof PeerstoreResponse
|
|
4409
|
-
* @static
|
|
4410
|
-
* @param {PeerstoreResponse} m PeerstoreResponse
|
|
4411
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
4412
|
-
* @returns {Object.<string,*>} Plain object
|
|
4413
|
-
*/
|
|
4414
|
-
PeerstoreResponse.toObject = function toObject(m, o) {
|
|
4415
|
-
if (!o)
|
|
4416
|
-
o = {};
|
|
4417
|
-
var d = {};
|
|
4418
|
-
if (o.arrays || o.defaults) {
|
|
4419
|
-
d.protos = [];
|
|
4420
|
-
}
|
|
4421
|
-
if (m.peer != null && m.hasOwnProperty("peer")) {
|
|
4422
|
-
d.peer = $root.PeerInfo.toObject(m.peer, o);
|
|
4423
|
-
if (o.oneofs)
|
|
4424
|
-
d._peer = "peer";
|
|
4425
|
-
}
|
|
4426
|
-
if (m.protos && m.protos.length) {
|
|
4427
|
-
d.protos = [];
|
|
4428
|
-
for (var j = 0; j < m.protos.length; ++j) {
|
|
4429
|
-
d.protos[j] = m.protos[j];
|
|
4430
|
-
}
|
|
4431
|
-
}
|
|
4432
|
-
return d;
|
|
4433
|
-
};
|
|
4434
|
-
|
|
4435
|
-
/**
|
|
4436
|
-
* Converts this PeerstoreResponse to JSON.
|
|
4437
|
-
* @function toJSON
|
|
4438
|
-
* @memberof PeerstoreResponse
|
|
4439
|
-
* @instance
|
|
4440
|
-
* @returns {Object.<string,*>} JSON object
|
|
4441
|
-
*/
|
|
4442
|
-
PeerstoreResponse.prototype.toJSON = function toJSON() {
|
|
4443
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
4444
|
-
};
|
|
4445
|
-
|
|
4446
|
-
return PeerstoreResponse;
|
|
4447
|
-
})();
|
|
4448
|
-
|
|
4449
|
-
export { $root as default };
|