libp2p 0.35.8 → 0.36.0
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 +55 -0
- package/dist/src/circuit/auto-relay.d.ts +8 -10
- package/dist/src/circuit/auto-relay.d.ts.map +1 -1
- package/dist/src/config.d.ts +2 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/connection-manager/auto-dialler.d.ts +1 -1
- package/dist/src/connection-manager/auto-dialler.d.ts.map +1 -1
- package/dist/src/connection-manager/index.d.ts +1 -2
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/content-routing/utils.d.ts +3 -3
- package/dist/src/content-routing/utils.d.ts.map +1 -1
- package/dist/src/dialer/dial-request.d.ts.map +1 -1
- package/dist/src/dialer/index.d.ts +12 -7
- package/dist/src/dialer/index.d.ts.map +1 -1
- package/dist/src/errors.d.ts +2 -0
- package/dist/src/fetch/constants.d.ts +2 -0
- package/dist/src/fetch/constants.d.ts.map +1 -0
- package/dist/src/fetch/index.d.ts +76 -0
- package/dist/src/fetch/index.d.ts.map +1 -0
- package/dist/src/fetch/proto.d.ts +134 -0
- package/dist/src/identify/index.d.ts +4 -4
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +116 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/metrics/index.d.ts +9 -4
- package/dist/src/metrics/index.d.ts.map +1 -1
- package/dist/src/metrics/tracked-map.d.ts +6 -1
- package/dist/src/metrics/tracked-map.d.ts.map +1 -1
- package/dist/src/peer-routing.d.ts +1 -1
- package/dist/src/peer-routing.d.ts.map +1 -1
- package/dist/src/peer-store/address-book.d.ts +30 -84
- package/dist/src/peer-store/address-book.d.ts.map +1 -1
- package/dist/src/peer-store/index.d.ts +28 -94
- package/dist/src/peer-store/index.d.ts.map +1 -1
- package/dist/src/peer-store/key-book.d.ts +31 -15
- package/dist/src/peer-store/key-book.d.ts.map +1 -1
- package/dist/src/peer-store/metadata-book.d.ts +33 -29
- package/dist/src/peer-store/metadata-book.d.ts.map +1 -1
- package/dist/src/peer-store/pb/peer.d.ts +222 -0
- package/dist/src/peer-store/proto-book.d.ts +27 -28
- package/dist/src/peer-store/proto-book.d.ts.map +1 -1
- package/dist/src/peer-store/store.d.ts +73 -0
- package/dist/src/peer-store/store.d.ts.map +1 -0
- package/dist/src/peer-store/types.d.ts +202 -0
- package/dist/src/peer-store/types.d.ts.map +1 -0
- package/dist/src/ping/index.d.ts.map +1 -1
- package/dist/src/record/peer-record/index.d.ts +2 -2
- package/dist/src/record/peer-record/index.d.ts.map +1 -1
- package/dist/src/registrar.d.ts +5 -5
- package/dist/src/registrar.d.ts.map +1 -1
- package/dist/src/types.d.ts +90 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/upgrader.d.ts +8 -2
- package/dist/src/upgrader.d.ts.map +1 -1
- package/package.json +23 -26
- package/src/circuit/auto-relay.js +52 -38
- package/src/config.js +2 -0
- package/src/connection-manager/auto-dialler.js +20 -8
- package/src/connection-manager/index.js +42 -22
- package/src/content-routing/utils.js +4 -4
- package/src/dialer/dial-request.js +4 -1
- package/src/dialer/index.js +38 -8
- package/src/errors.js +2 -0
- package/src/fetch/README.md +36 -0
- package/src/fetch/constants.js +6 -0
- package/src/fetch/index.js +159 -0
- package/src/fetch/proto.d.ts +134 -0
- package/src/fetch/proto.js +333 -0
- package/src/fetch/proto.proto +15 -0
- package/src/identify/index.js +47 -38
- package/src/index.js +72 -27
- package/src/metrics/index.js +15 -8
- package/src/metrics/tracked-map.js +40 -14
- package/src/peer-routing.js +4 -1
- package/src/peer-store/address-book.js +254 -226
- package/src/peer-store/index.js +79 -110
- package/src/peer-store/key-book.js +99 -54
- package/src/peer-store/metadata-book.js +171 -101
- package/src/peer-store/pb/peer.d.ts +222 -0
- package/src/peer-store/pb/peer.js +643 -0
- package/src/peer-store/pb/peer.proto +31 -0
- package/src/peer-store/proto-book.js +171 -105
- package/src/peer-store/store.js +263 -0
- package/src/peer-store/types.ts +245 -0
- package/src/ping/index.js +6 -0
- package/src/record/peer-record/index.js +1 -1
- package/src/record/utils.js +1 -1
- package/src/registrar.js +4 -4
- package/src/types.ts +98 -0
- package/src/upgrader.js +32 -2
- package/dist/src/peer-store/book.d.ts +0 -81
- package/dist/src/peer-store/book.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/consts.d.ts +0 -6
- package/dist/src/peer-store/persistent/consts.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/index.d.ts +0 -129
- package/dist/src/peer-store/persistent/index.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/pb/address-book.d.ts +0 -198
- package/dist/src/peer-store/persistent/pb/proto-book.d.ts +0 -59
- package/src/peer-store/book.js +0 -124
- package/src/peer-store/persistent/consts.js +0 -15
- package/src/peer-store/persistent/index.js +0 -408
- package/src/peer-store/persistent/pb/address-book.d.ts +0 -198
- package/src/peer-store/persistent/pb/address-book.js +0 -522
- package/src/peer-store/persistent/pb/address-book.proto +0 -27
- package/src/peer-store/persistent/pb/proto-book.d.ts +0 -59
- package/src/peer-store/persistent/pb/proto-book.js +0 -157
- package/src/peer-store/persistent/pb/proto-book.proto +0 -5
|
@@ -1,522 +0,0 @@
|
|
|
1
|
-
/*eslint-disable*/
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var $protobuf = require("protobufjs/minimal");
|
|
5
|
-
|
|
6
|
-
// Common aliases
|
|
7
|
-
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
|
8
|
-
|
|
9
|
-
// Exported root namespace
|
|
10
|
-
var $root = $protobuf.roots["libp2p-address-book"] || ($protobuf.roots["libp2p-address-book"] = {});
|
|
11
|
-
|
|
12
|
-
$root.Addresses = (function() {
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Properties of an Addresses.
|
|
16
|
-
* @exports IAddresses
|
|
17
|
-
* @interface IAddresses
|
|
18
|
-
* @property {Array.<Addresses.IAddress>|null} [addrs] Addresses addrs
|
|
19
|
-
* @property {Addresses.ICertifiedRecord|null} [certifiedRecord] Addresses certifiedRecord
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new Addresses.
|
|
24
|
-
* @exports Addresses
|
|
25
|
-
* @classdesc Represents an Addresses.
|
|
26
|
-
* @implements IAddresses
|
|
27
|
-
* @constructor
|
|
28
|
-
* @param {IAddresses=} [p] Properties to set
|
|
29
|
-
*/
|
|
30
|
-
function Addresses(p) {
|
|
31
|
-
this.addrs = [];
|
|
32
|
-
if (p)
|
|
33
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
34
|
-
if (p[ks[i]] != null)
|
|
35
|
-
this[ks[i]] = p[ks[i]];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Addresses addrs.
|
|
40
|
-
* @member {Array.<Addresses.IAddress>} addrs
|
|
41
|
-
* @memberof Addresses
|
|
42
|
-
* @instance
|
|
43
|
-
*/
|
|
44
|
-
Addresses.prototype.addrs = $util.emptyArray;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Addresses certifiedRecord.
|
|
48
|
-
* @member {Addresses.ICertifiedRecord|null|undefined} certifiedRecord
|
|
49
|
-
* @memberof Addresses
|
|
50
|
-
* @instance
|
|
51
|
-
*/
|
|
52
|
-
Addresses.prototype.certifiedRecord = null;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Encodes the specified Addresses message. Does not implicitly {@link Addresses.verify|verify} messages.
|
|
56
|
-
* @function encode
|
|
57
|
-
* @memberof Addresses
|
|
58
|
-
* @static
|
|
59
|
-
* @param {IAddresses} m Addresses message or plain object to encode
|
|
60
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
61
|
-
* @returns {$protobuf.Writer} Writer
|
|
62
|
-
*/
|
|
63
|
-
Addresses.encode = function encode(m, w) {
|
|
64
|
-
if (!w)
|
|
65
|
-
w = $Writer.create();
|
|
66
|
-
if (m.addrs != null && m.addrs.length) {
|
|
67
|
-
for (var i = 0; i < m.addrs.length; ++i)
|
|
68
|
-
$root.Addresses.Address.encode(m.addrs[i], w.uint32(10).fork()).ldelim();
|
|
69
|
-
}
|
|
70
|
-
if (m.certifiedRecord != null && Object.hasOwnProperty.call(m, "certifiedRecord"))
|
|
71
|
-
$root.Addresses.CertifiedRecord.encode(m.certifiedRecord, w.uint32(18).fork()).ldelim();
|
|
72
|
-
return w;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Decodes an Addresses message from the specified reader or buffer.
|
|
77
|
-
* @function decode
|
|
78
|
-
* @memberof Addresses
|
|
79
|
-
* @static
|
|
80
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
81
|
-
* @param {number} [l] Message length if known beforehand
|
|
82
|
-
* @returns {Addresses} Addresses
|
|
83
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
84
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
85
|
-
*/
|
|
86
|
-
Addresses.decode = function decode(r, l) {
|
|
87
|
-
if (!(r instanceof $Reader))
|
|
88
|
-
r = $Reader.create(r);
|
|
89
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.Addresses();
|
|
90
|
-
while (r.pos < c) {
|
|
91
|
-
var t = r.uint32();
|
|
92
|
-
switch (t >>> 3) {
|
|
93
|
-
case 1:
|
|
94
|
-
if (!(m.addrs && m.addrs.length))
|
|
95
|
-
m.addrs = [];
|
|
96
|
-
m.addrs.push($root.Addresses.Address.decode(r, r.uint32()));
|
|
97
|
-
break;
|
|
98
|
-
case 2:
|
|
99
|
-
m.certifiedRecord = $root.Addresses.CertifiedRecord.decode(r, r.uint32());
|
|
100
|
-
break;
|
|
101
|
-
default:
|
|
102
|
-
r.skipType(t & 7);
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return m;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Creates an Addresses message from a plain object. Also converts values to their respective internal types.
|
|
111
|
-
* @function fromObject
|
|
112
|
-
* @memberof Addresses
|
|
113
|
-
* @static
|
|
114
|
-
* @param {Object.<string,*>} d Plain object
|
|
115
|
-
* @returns {Addresses} Addresses
|
|
116
|
-
*/
|
|
117
|
-
Addresses.fromObject = function fromObject(d) {
|
|
118
|
-
if (d instanceof $root.Addresses)
|
|
119
|
-
return d;
|
|
120
|
-
var m = new $root.Addresses();
|
|
121
|
-
if (d.addrs) {
|
|
122
|
-
if (!Array.isArray(d.addrs))
|
|
123
|
-
throw TypeError(".Addresses.addrs: array expected");
|
|
124
|
-
m.addrs = [];
|
|
125
|
-
for (var i = 0; i < d.addrs.length; ++i) {
|
|
126
|
-
if (typeof d.addrs[i] !== "object")
|
|
127
|
-
throw TypeError(".Addresses.addrs: object expected");
|
|
128
|
-
m.addrs[i] = $root.Addresses.Address.fromObject(d.addrs[i]);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (d.certifiedRecord != null) {
|
|
132
|
-
if (typeof d.certifiedRecord !== "object")
|
|
133
|
-
throw TypeError(".Addresses.certifiedRecord: object expected");
|
|
134
|
-
m.certifiedRecord = $root.Addresses.CertifiedRecord.fromObject(d.certifiedRecord);
|
|
135
|
-
}
|
|
136
|
-
return m;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Creates a plain object from an Addresses message. Also converts values to other types if specified.
|
|
141
|
-
* @function toObject
|
|
142
|
-
* @memberof Addresses
|
|
143
|
-
* @static
|
|
144
|
-
* @param {Addresses} m Addresses
|
|
145
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
146
|
-
* @returns {Object.<string,*>} Plain object
|
|
147
|
-
*/
|
|
148
|
-
Addresses.toObject = function toObject(m, o) {
|
|
149
|
-
if (!o)
|
|
150
|
-
o = {};
|
|
151
|
-
var d = {};
|
|
152
|
-
if (o.arrays || o.defaults) {
|
|
153
|
-
d.addrs = [];
|
|
154
|
-
}
|
|
155
|
-
if (o.defaults) {
|
|
156
|
-
d.certifiedRecord = null;
|
|
157
|
-
}
|
|
158
|
-
if (m.addrs && m.addrs.length) {
|
|
159
|
-
d.addrs = [];
|
|
160
|
-
for (var j = 0; j < m.addrs.length; ++j) {
|
|
161
|
-
d.addrs[j] = $root.Addresses.Address.toObject(m.addrs[j], o);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
if (m.certifiedRecord != null && m.hasOwnProperty("certifiedRecord")) {
|
|
165
|
-
d.certifiedRecord = $root.Addresses.CertifiedRecord.toObject(m.certifiedRecord, o);
|
|
166
|
-
}
|
|
167
|
-
return d;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Converts this Addresses to JSON.
|
|
172
|
-
* @function toJSON
|
|
173
|
-
* @memberof Addresses
|
|
174
|
-
* @instance
|
|
175
|
-
* @returns {Object.<string,*>} JSON object
|
|
176
|
-
*/
|
|
177
|
-
Addresses.prototype.toJSON = function toJSON() {
|
|
178
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
Addresses.Address = (function() {
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Properties of an Address.
|
|
185
|
-
* @memberof Addresses
|
|
186
|
-
* @interface IAddress
|
|
187
|
-
* @property {Uint8Array|null} [multiaddr] Address multiaddr
|
|
188
|
-
* @property {boolean|null} [isCertified] Address isCertified
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Constructs a new Address.
|
|
193
|
-
* @memberof Addresses
|
|
194
|
-
* @classdesc Represents an Address.
|
|
195
|
-
* @implements IAddress
|
|
196
|
-
* @constructor
|
|
197
|
-
* @param {Addresses.IAddress=} [p] Properties to set
|
|
198
|
-
*/
|
|
199
|
-
function Address(p) {
|
|
200
|
-
if (p)
|
|
201
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
202
|
-
if (p[ks[i]] != null)
|
|
203
|
-
this[ks[i]] = p[ks[i]];
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Address multiaddr.
|
|
208
|
-
* @member {Uint8Array} multiaddr
|
|
209
|
-
* @memberof Addresses.Address
|
|
210
|
-
* @instance
|
|
211
|
-
*/
|
|
212
|
-
Address.prototype.multiaddr = $util.newBuffer([]);
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Address isCertified.
|
|
216
|
-
* @member {boolean} isCertified
|
|
217
|
-
* @memberof Addresses.Address
|
|
218
|
-
* @instance
|
|
219
|
-
*/
|
|
220
|
-
Address.prototype.isCertified = false;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Encodes the specified Address message. Does not implicitly {@link Addresses.Address.verify|verify} messages.
|
|
224
|
-
* @function encode
|
|
225
|
-
* @memberof Addresses.Address
|
|
226
|
-
* @static
|
|
227
|
-
* @param {Addresses.IAddress} m Address message or plain object to encode
|
|
228
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
229
|
-
* @returns {$protobuf.Writer} Writer
|
|
230
|
-
*/
|
|
231
|
-
Address.encode = function encode(m, w) {
|
|
232
|
-
if (!w)
|
|
233
|
-
w = $Writer.create();
|
|
234
|
-
if (m.multiaddr != null && Object.hasOwnProperty.call(m, "multiaddr"))
|
|
235
|
-
w.uint32(10).bytes(m.multiaddr);
|
|
236
|
-
if (m.isCertified != null && Object.hasOwnProperty.call(m, "isCertified"))
|
|
237
|
-
w.uint32(16).bool(m.isCertified);
|
|
238
|
-
return w;
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Decodes an Address message from the specified reader or buffer.
|
|
243
|
-
* @function decode
|
|
244
|
-
* @memberof Addresses.Address
|
|
245
|
-
* @static
|
|
246
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
247
|
-
* @param {number} [l] Message length if known beforehand
|
|
248
|
-
* @returns {Addresses.Address} Address
|
|
249
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
250
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
251
|
-
*/
|
|
252
|
-
Address.decode = function decode(r, l) {
|
|
253
|
-
if (!(r instanceof $Reader))
|
|
254
|
-
r = $Reader.create(r);
|
|
255
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.Addresses.Address();
|
|
256
|
-
while (r.pos < c) {
|
|
257
|
-
var t = r.uint32();
|
|
258
|
-
switch (t >>> 3) {
|
|
259
|
-
case 1:
|
|
260
|
-
m.multiaddr = r.bytes();
|
|
261
|
-
break;
|
|
262
|
-
case 2:
|
|
263
|
-
m.isCertified = r.bool();
|
|
264
|
-
break;
|
|
265
|
-
default:
|
|
266
|
-
r.skipType(t & 7);
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return m;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Creates an Address message from a plain object. Also converts values to their respective internal types.
|
|
275
|
-
* @function fromObject
|
|
276
|
-
* @memberof Addresses.Address
|
|
277
|
-
* @static
|
|
278
|
-
* @param {Object.<string,*>} d Plain object
|
|
279
|
-
* @returns {Addresses.Address} Address
|
|
280
|
-
*/
|
|
281
|
-
Address.fromObject = function fromObject(d) {
|
|
282
|
-
if (d instanceof $root.Addresses.Address)
|
|
283
|
-
return d;
|
|
284
|
-
var m = new $root.Addresses.Address();
|
|
285
|
-
if (d.multiaddr != null) {
|
|
286
|
-
if (typeof d.multiaddr === "string")
|
|
287
|
-
$util.base64.decode(d.multiaddr, m.multiaddr = $util.newBuffer($util.base64.length(d.multiaddr)), 0);
|
|
288
|
-
else if (d.multiaddr.length)
|
|
289
|
-
m.multiaddr = d.multiaddr;
|
|
290
|
-
}
|
|
291
|
-
if (d.isCertified != null) {
|
|
292
|
-
m.isCertified = Boolean(d.isCertified);
|
|
293
|
-
}
|
|
294
|
-
return m;
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Creates a plain object from an Address message. Also converts values to other types if specified.
|
|
299
|
-
* @function toObject
|
|
300
|
-
* @memberof Addresses.Address
|
|
301
|
-
* @static
|
|
302
|
-
* @param {Addresses.Address} m Address
|
|
303
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
304
|
-
* @returns {Object.<string,*>} Plain object
|
|
305
|
-
*/
|
|
306
|
-
Address.toObject = function toObject(m, o) {
|
|
307
|
-
if (!o)
|
|
308
|
-
o = {};
|
|
309
|
-
var d = {};
|
|
310
|
-
if (o.defaults) {
|
|
311
|
-
if (o.bytes === String)
|
|
312
|
-
d.multiaddr = "";
|
|
313
|
-
else {
|
|
314
|
-
d.multiaddr = [];
|
|
315
|
-
if (o.bytes !== Array)
|
|
316
|
-
d.multiaddr = $util.newBuffer(d.multiaddr);
|
|
317
|
-
}
|
|
318
|
-
d.isCertified = false;
|
|
319
|
-
}
|
|
320
|
-
if (m.multiaddr != null && m.hasOwnProperty("multiaddr")) {
|
|
321
|
-
d.multiaddr = o.bytes === String ? $util.base64.encode(m.multiaddr, 0, m.multiaddr.length) : o.bytes === Array ? Array.prototype.slice.call(m.multiaddr) : m.multiaddr;
|
|
322
|
-
}
|
|
323
|
-
if (m.isCertified != null && m.hasOwnProperty("isCertified")) {
|
|
324
|
-
d.isCertified = m.isCertified;
|
|
325
|
-
}
|
|
326
|
-
return d;
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Converts this Address to JSON.
|
|
331
|
-
* @function toJSON
|
|
332
|
-
* @memberof Addresses.Address
|
|
333
|
-
* @instance
|
|
334
|
-
* @returns {Object.<string,*>} JSON object
|
|
335
|
-
*/
|
|
336
|
-
Address.prototype.toJSON = function toJSON() {
|
|
337
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
return Address;
|
|
341
|
-
})();
|
|
342
|
-
|
|
343
|
-
Addresses.CertifiedRecord = (function() {
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Properties of a CertifiedRecord.
|
|
347
|
-
* @memberof Addresses
|
|
348
|
-
* @interface ICertifiedRecord
|
|
349
|
-
* @property {number|null} [seq] CertifiedRecord seq
|
|
350
|
-
* @property {Uint8Array|null} [raw] CertifiedRecord raw
|
|
351
|
-
*/
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Constructs a new CertifiedRecord.
|
|
355
|
-
* @memberof Addresses
|
|
356
|
-
* @classdesc Represents a CertifiedRecord.
|
|
357
|
-
* @implements ICertifiedRecord
|
|
358
|
-
* @constructor
|
|
359
|
-
* @param {Addresses.ICertifiedRecord=} [p] Properties to set
|
|
360
|
-
*/
|
|
361
|
-
function CertifiedRecord(p) {
|
|
362
|
-
if (p)
|
|
363
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
364
|
-
if (p[ks[i]] != null)
|
|
365
|
-
this[ks[i]] = p[ks[i]];
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* CertifiedRecord seq.
|
|
370
|
-
* @member {number} seq
|
|
371
|
-
* @memberof Addresses.CertifiedRecord
|
|
372
|
-
* @instance
|
|
373
|
-
*/
|
|
374
|
-
CertifiedRecord.prototype.seq = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* CertifiedRecord raw.
|
|
378
|
-
* @member {Uint8Array} raw
|
|
379
|
-
* @memberof Addresses.CertifiedRecord
|
|
380
|
-
* @instance
|
|
381
|
-
*/
|
|
382
|
-
CertifiedRecord.prototype.raw = $util.newBuffer([]);
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Encodes the specified CertifiedRecord message. Does not implicitly {@link Addresses.CertifiedRecord.verify|verify} messages.
|
|
386
|
-
* @function encode
|
|
387
|
-
* @memberof Addresses.CertifiedRecord
|
|
388
|
-
* @static
|
|
389
|
-
* @param {Addresses.ICertifiedRecord} m CertifiedRecord message or plain object to encode
|
|
390
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
391
|
-
* @returns {$protobuf.Writer} Writer
|
|
392
|
-
*/
|
|
393
|
-
CertifiedRecord.encode = function encode(m, w) {
|
|
394
|
-
if (!w)
|
|
395
|
-
w = $Writer.create();
|
|
396
|
-
if (m.seq != null && Object.hasOwnProperty.call(m, "seq"))
|
|
397
|
-
w.uint32(8).uint64(m.seq);
|
|
398
|
-
if (m.raw != null && Object.hasOwnProperty.call(m, "raw"))
|
|
399
|
-
w.uint32(18).bytes(m.raw);
|
|
400
|
-
return w;
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Decodes a CertifiedRecord message from the specified reader or buffer.
|
|
405
|
-
* @function decode
|
|
406
|
-
* @memberof Addresses.CertifiedRecord
|
|
407
|
-
* @static
|
|
408
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
409
|
-
* @param {number} [l] Message length if known beforehand
|
|
410
|
-
* @returns {Addresses.CertifiedRecord} CertifiedRecord
|
|
411
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
412
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
413
|
-
*/
|
|
414
|
-
CertifiedRecord.decode = function decode(r, l) {
|
|
415
|
-
if (!(r instanceof $Reader))
|
|
416
|
-
r = $Reader.create(r);
|
|
417
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.Addresses.CertifiedRecord();
|
|
418
|
-
while (r.pos < c) {
|
|
419
|
-
var t = r.uint32();
|
|
420
|
-
switch (t >>> 3) {
|
|
421
|
-
case 1:
|
|
422
|
-
m.seq = r.uint64();
|
|
423
|
-
break;
|
|
424
|
-
case 2:
|
|
425
|
-
m.raw = r.bytes();
|
|
426
|
-
break;
|
|
427
|
-
default:
|
|
428
|
-
r.skipType(t & 7);
|
|
429
|
-
break;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
return m;
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Creates a CertifiedRecord message from a plain object. Also converts values to their respective internal types.
|
|
437
|
-
* @function fromObject
|
|
438
|
-
* @memberof Addresses.CertifiedRecord
|
|
439
|
-
* @static
|
|
440
|
-
* @param {Object.<string,*>} d Plain object
|
|
441
|
-
* @returns {Addresses.CertifiedRecord} CertifiedRecord
|
|
442
|
-
*/
|
|
443
|
-
CertifiedRecord.fromObject = function fromObject(d) {
|
|
444
|
-
if (d instanceof $root.Addresses.CertifiedRecord)
|
|
445
|
-
return d;
|
|
446
|
-
var m = new $root.Addresses.CertifiedRecord();
|
|
447
|
-
if (d.seq != null) {
|
|
448
|
-
if ($util.Long)
|
|
449
|
-
(m.seq = $util.Long.fromValue(d.seq)).unsigned = true;
|
|
450
|
-
else if (typeof d.seq === "string")
|
|
451
|
-
m.seq = parseInt(d.seq, 10);
|
|
452
|
-
else if (typeof d.seq === "number")
|
|
453
|
-
m.seq = d.seq;
|
|
454
|
-
else if (typeof d.seq === "object")
|
|
455
|
-
m.seq = new $util.LongBits(d.seq.low >>> 0, d.seq.high >>> 0).toNumber(true);
|
|
456
|
-
}
|
|
457
|
-
if (d.raw != null) {
|
|
458
|
-
if (typeof d.raw === "string")
|
|
459
|
-
$util.base64.decode(d.raw, m.raw = $util.newBuffer($util.base64.length(d.raw)), 0);
|
|
460
|
-
else if (d.raw.length)
|
|
461
|
-
m.raw = d.raw;
|
|
462
|
-
}
|
|
463
|
-
return m;
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Creates a plain object from a CertifiedRecord message. Also converts values to other types if specified.
|
|
468
|
-
* @function toObject
|
|
469
|
-
* @memberof Addresses.CertifiedRecord
|
|
470
|
-
* @static
|
|
471
|
-
* @param {Addresses.CertifiedRecord} m CertifiedRecord
|
|
472
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
473
|
-
* @returns {Object.<string,*>} Plain object
|
|
474
|
-
*/
|
|
475
|
-
CertifiedRecord.toObject = function toObject(m, o) {
|
|
476
|
-
if (!o)
|
|
477
|
-
o = {};
|
|
478
|
-
var d = {};
|
|
479
|
-
if (o.defaults) {
|
|
480
|
-
if ($util.Long) {
|
|
481
|
-
var n = new $util.Long(0, 0, true);
|
|
482
|
-
d.seq = o.longs === String ? n.toString() : o.longs === Number ? n.toNumber() : n;
|
|
483
|
-
} else
|
|
484
|
-
d.seq = o.longs === String ? "0" : 0;
|
|
485
|
-
if (o.bytes === String)
|
|
486
|
-
d.raw = "";
|
|
487
|
-
else {
|
|
488
|
-
d.raw = [];
|
|
489
|
-
if (o.bytes !== Array)
|
|
490
|
-
d.raw = $util.newBuffer(d.raw);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
if (m.seq != null && m.hasOwnProperty("seq")) {
|
|
494
|
-
if (typeof m.seq === "number")
|
|
495
|
-
d.seq = o.longs === String ? String(m.seq) : m.seq;
|
|
496
|
-
else
|
|
497
|
-
d.seq = o.longs === String ? $util.Long.prototype.toString.call(m.seq) : o.longs === Number ? new $util.LongBits(m.seq.low >>> 0, m.seq.high >>> 0).toNumber(true) : m.seq;
|
|
498
|
-
}
|
|
499
|
-
if (m.raw != null && m.hasOwnProperty("raw")) {
|
|
500
|
-
d.raw = o.bytes === String ? $util.base64.encode(m.raw, 0, m.raw.length) : o.bytes === Array ? Array.prototype.slice.call(m.raw) : m.raw;
|
|
501
|
-
}
|
|
502
|
-
return d;
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Converts this CertifiedRecord to JSON.
|
|
507
|
-
* @function toJSON
|
|
508
|
-
* @memberof Addresses.CertifiedRecord
|
|
509
|
-
* @instance
|
|
510
|
-
* @returns {Object.<string,*>} JSON object
|
|
511
|
-
*/
|
|
512
|
-
CertifiedRecord.prototype.toJSON = function toJSON() {
|
|
513
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
return CertifiedRecord;
|
|
517
|
-
})();
|
|
518
|
-
|
|
519
|
-
return Addresses;
|
|
520
|
-
})();
|
|
521
|
-
|
|
522
|
-
module.exports = $root;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
message Addresses {
|
|
4
|
-
// Address represents a single multiaddr.
|
|
5
|
-
message Address {
|
|
6
|
-
bytes multiaddr = 1;
|
|
7
|
-
|
|
8
|
-
// Flag to indicate if the address comes from a certified source.
|
|
9
|
-
optional bool isCertified = 2;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// CertifiedRecord contains a serialized signed PeerRecord used to
|
|
13
|
-
// populate the signedAddrs list.
|
|
14
|
-
message CertifiedRecord {
|
|
15
|
-
// The Seq counter from the signed PeerRecord envelope
|
|
16
|
-
uint64 seq = 1;
|
|
17
|
-
|
|
18
|
-
// The serialized bytes of the SignedEnvelope containing the PeerRecord.
|
|
19
|
-
bytes raw = 2;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// The known multiaddrs.
|
|
23
|
-
repeated Address addrs = 1;
|
|
24
|
-
|
|
25
|
-
// The most recently received signed PeerRecord.
|
|
26
|
-
CertifiedRecord certified_record = 2;
|
|
27
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as $protobuf from "protobufjs";
|
|
2
|
-
/** Properties of a Protocols. */
|
|
3
|
-
export interface IProtocols {
|
|
4
|
-
|
|
5
|
-
/** Protocols protocols */
|
|
6
|
-
protocols?: (string[]|null);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** Represents a Protocols. */
|
|
10
|
-
export class Protocols implements IProtocols {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Constructs a new Protocols.
|
|
14
|
-
* @param [p] Properties to set
|
|
15
|
-
*/
|
|
16
|
-
constructor(p?: IProtocols);
|
|
17
|
-
|
|
18
|
-
/** Protocols protocols. */
|
|
19
|
-
public protocols: string[];
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Encodes the specified Protocols message. Does not implicitly {@link Protocols.verify|verify} messages.
|
|
23
|
-
* @param m Protocols message or plain object to encode
|
|
24
|
-
* @param [w] Writer to encode to
|
|
25
|
-
* @returns Writer
|
|
26
|
-
*/
|
|
27
|
-
public static encode(m: IProtocols, w?: $protobuf.Writer): $protobuf.Writer;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Decodes a Protocols message from the specified reader or buffer.
|
|
31
|
-
* @param r Reader or buffer to decode from
|
|
32
|
-
* @param [l] Message length if known beforehand
|
|
33
|
-
* @returns Protocols
|
|
34
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
35
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
36
|
-
*/
|
|
37
|
-
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Protocols;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Creates a Protocols message from a plain object. Also converts values to their respective internal types.
|
|
41
|
-
* @param d Plain object
|
|
42
|
-
* @returns Protocols
|
|
43
|
-
*/
|
|
44
|
-
public static fromObject(d: { [k: string]: any }): Protocols;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Creates a plain object from a Protocols message. Also converts values to other types if specified.
|
|
48
|
-
* @param m Protocols
|
|
49
|
-
* @param [o] Conversion options
|
|
50
|
-
* @returns Plain object
|
|
51
|
-
*/
|
|
52
|
-
public static toObject(m: Protocols, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Converts this Protocols to JSON.
|
|
56
|
-
* @returns JSON object
|
|
57
|
-
*/
|
|
58
|
-
public toJSON(): { [k: string]: any };
|
|
59
|
-
}
|