libp2p 0.36.2-cc60cfd → 0.36.2-fab4f13
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/src/circuit/circuit/hop.d.ts +3 -3
- package/dist/src/circuit/circuit/hop.d.ts.map +1 -1
- package/dist/src/circuit/circuit/hop.js +1 -1
- package/dist/src/circuit/circuit/hop.js.map +1 -1
- package/dist/src/circuit/circuit/stop.d.ts +3 -3
- package/dist/src/circuit/circuit/stop.d.ts.map +1 -1
- package/dist/src/circuit/circuit/stop.js.map +1 -1
- package/dist/src/circuit/circuit/stream-handler.d.ts +4 -4
- package/dist/src/circuit/circuit/stream-handler.d.ts.map +1 -1
- package/dist/src/circuit/circuit/stream-handler.js +2 -3
- package/dist/src/circuit/circuit/stream-handler.js.map +1 -1
- package/dist/src/circuit/circuit/utils.d.ts +2 -2
- package/dist/src/circuit/circuit/utils.d.ts.map +1 -1
- package/dist/src/circuit/circuit/utils.js.map +1 -1
- package/dist/src/circuit/pb/index.d.ts +42 -164
- package/dist/src/circuit/pb/index.d.ts.map +1 -0
- package/dist/src/circuit/pb/index.js +67 -523
- package/dist/src/circuit/pb/index.js.map +1 -0
- package/dist/src/dht/dummy-dht.d.ts +17 -0
- package/dist/src/dht/dummy-dht.d.ts.map +1 -0
- package/dist/src/dht/dummy-dht.js +39 -0
- package/dist/src/dht/dummy-dht.js.map +1 -0
- package/dist/src/dialer/index.d.ts.map +1 -1
- package/dist/src/dialer/index.js +0 -1
- package/dist/src/dialer/index.js.map +1 -1
- package/dist/src/errors.d.ts +2 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +2 -0
- package/dist/src/errors.js.map +1 -1
- package/dist/src/fetch/index.d.ts.map +1 -1
- package/dist/src/fetch/index.js +5 -6
- package/dist/src/fetch/index.js.map +1 -1
- package/dist/src/fetch/pb/proto.d.ts +20 -128
- package/dist/src/fetch/pb/proto.d.ts.map +1 -0
- package/dist/src/fetch/pb/proto.js +44 -331
- package/dist/src/fetch/pb/proto.js.map +1 -0
- package/dist/src/identify/index.d.ts +4 -2
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/identify/index.js +8 -8
- package/dist/src/identify/index.js.map +1 -1
- package/dist/src/identify/pb/message.d.ts +13 -108
- package/dist/src/identify/pb/message.d.ts.map +1 -0
- package/dist/src/identify/pb/message.js +21 -366
- package/dist/src/identify/pb/message.js.map +1 -0
- package/dist/src/index.d.ts +11 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/insecure/index.d.ts.map +1 -1
- package/dist/src/insecure/index.js +5 -2
- package/dist/src/insecure/index.js.map +1 -1
- package/dist/src/insecure/pb/proto.d.ts +24 -130
- package/dist/src/insecure/pb/proto.d.ts.map +1 -0
- package/dist/src/insecure/pb/proto.js +46 -388
- package/dist/src/insecure/pb/proto.js.map +1 -0
- package/dist/src/keychain/index.d.ts +3 -3
- package/dist/src/keychain/index.js +2 -2
- package/dist/src/keychain/util.d.ts +1 -1
- package/dist/src/keychain/util.d.ts.map +1 -1
- package/dist/src/libp2p.d.ts +7 -4
- package/dist/src/libp2p.d.ts.map +1 -1
- package/dist/src/libp2p.js +20 -5
- package/dist/src/libp2p.js.map +1 -1
- package/dist/src/metrics/stats.d.ts +1 -5
- package/dist/src/metrics/stats.d.ts.map +1 -1
- package/dist/src/metrics/stats.js.map +1 -1
- package/dist/src/pubsub/dummy-pubsub.d.ts +17 -0
- package/dist/src/pubsub/dummy-pubsub.d.ts.map +1 -0
- package/dist/src/pubsub/dummy-pubsub.js +37 -0
- package/dist/src/pubsub/dummy-pubsub.js.map +1 -0
- package/package.json +45 -44
- package/src/circuit/circuit/hop.ts +4 -4
- package/src/circuit/circuit/stop.ts +3 -3
- package/src/circuit/circuit/stream-handler.ts +5 -6
- package/src/circuit/circuit/utils.ts +2 -2
- package/src/circuit/pb/index.proto +1 -1
- package/src/circuit/pb/index.ts +88 -0
- package/src/dht/dummy-dht.ts +51 -0
- package/src/dialer/index.ts +0 -3
- package/src/errors.ts +2 -0
- package/src/fetch/index.ts +6 -7
- package/src/fetch/pb/proto.ts +58 -0
- package/src/identify/index.ts +10 -10
- package/src/identify/pb/message.ts +36 -0
- package/src/index.ts +12 -5
- package/src/insecure/index.ts +8 -4
- package/src/insecure/pb/proto.ts +61 -0
- package/src/keychain/index.ts +2 -2
- package/src/libp2p.ts +27 -9
- package/src/metrics/stats.ts +1 -6
- package/src/pubsub/dummy-pubsub.ts +51 -0
- package/src/circuit/pb/index.d.ts +0 -173
- package/src/circuit/pb/index.js +0 -528
- package/src/fetch/pb/proto.d.ts +0 -134
- package/src/fetch/pb/proto.js +0 -331
- package/src/identify/pb/message.d.ts +0 -110
- package/src/identify/pb/message.js +0 -369
- package/src/insecure/pb/proto.d.ts +0 -134
- package/src/insecure/pb/proto.js +0 -388
package/src/fetch/pb/proto.d.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import * as $protobuf from "protobufjs";
|
|
2
|
-
/** Properties of a FetchRequest. */
|
|
3
|
-
export interface IFetchRequest {
|
|
4
|
-
|
|
5
|
-
/** FetchRequest identifier */
|
|
6
|
-
identifier?: (string|null);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** Represents a FetchRequest. */
|
|
10
|
-
export class FetchRequest implements IFetchRequest {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Constructs a new FetchRequest.
|
|
14
|
-
* @param [p] Properties to set
|
|
15
|
-
*/
|
|
16
|
-
constructor(p?: IFetchRequest);
|
|
17
|
-
|
|
18
|
-
/** FetchRequest identifier. */
|
|
19
|
-
public identifier: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Encodes the specified FetchRequest message. Does not implicitly {@link FetchRequest.verify|verify} messages.
|
|
23
|
-
* @param m FetchRequest message or plain object to encode
|
|
24
|
-
* @param [w] Writer to encode to
|
|
25
|
-
* @returns Writer
|
|
26
|
-
*/
|
|
27
|
-
public static encode(m: IFetchRequest, w?: $protobuf.Writer): $protobuf.Writer;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Decodes a FetchRequest 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 FetchRequest
|
|
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): FetchRequest;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Creates a FetchRequest message from a plain object. Also converts values to their respective internal types.
|
|
41
|
-
* @param d Plain object
|
|
42
|
-
* @returns FetchRequest
|
|
43
|
-
*/
|
|
44
|
-
public static fromObject(d: { [k: string]: any }): FetchRequest;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Creates a plain object from a FetchRequest message. Also converts values to other types if specified.
|
|
48
|
-
* @param m FetchRequest
|
|
49
|
-
* @param [o] Conversion options
|
|
50
|
-
* @returns Plain object
|
|
51
|
-
*/
|
|
52
|
-
public static toObject(m: FetchRequest, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Converts this FetchRequest to JSON.
|
|
56
|
-
* @returns JSON object
|
|
57
|
-
*/
|
|
58
|
-
public toJSON(): { [k: string]: any };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** Properties of a FetchResponse. */
|
|
62
|
-
export interface IFetchResponse {
|
|
63
|
-
|
|
64
|
-
/** FetchResponse status */
|
|
65
|
-
status?: (FetchResponse.StatusCode|null);
|
|
66
|
-
|
|
67
|
-
/** FetchResponse data */
|
|
68
|
-
data?: (Uint8Array|null);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** Represents a FetchResponse. */
|
|
72
|
-
export class FetchResponse implements IFetchResponse {
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Constructs a new FetchResponse.
|
|
76
|
-
* @param [p] Properties to set
|
|
77
|
-
*/
|
|
78
|
-
constructor(p?: IFetchResponse);
|
|
79
|
-
|
|
80
|
-
/** FetchResponse status. */
|
|
81
|
-
public status: FetchResponse.StatusCode;
|
|
82
|
-
|
|
83
|
-
/** FetchResponse data. */
|
|
84
|
-
public data: Uint8Array;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Encodes the specified FetchResponse message. Does not implicitly {@link FetchResponse.verify|verify} messages.
|
|
88
|
-
* @param m FetchResponse message or plain object to encode
|
|
89
|
-
* @param [w] Writer to encode to
|
|
90
|
-
* @returns Writer
|
|
91
|
-
*/
|
|
92
|
-
public static encode(m: IFetchResponse, w?: $protobuf.Writer): $protobuf.Writer;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Decodes a FetchResponse message from the specified reader or buffer.
|
|
96
|
-
* @param r Reader or buffer to decode from
|
|
97
|
-
* @param [l] Message length if known beforehand
|
|
98
|
-
* @returns FetchResponse
|
|
99
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
100
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
101
|
-
*/
|
|
102
|
-
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): FetchResponse;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Creates a FetchResponse message from a plain object. Also converts values to their respective internal types.
|
|
106
|
-
* @param d Plain object
|
|
107
|
-
* @returns FetchResponse
|
|
108
|
-
*/
|
|
109
|
-
public static fromObject(d: { [k: string]: any }): FetchResponse;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Creates a plain object from a FetchResponse message. Also converts values to other types if specified.
|
|
113
|
-
* @param m FetchResponse
|
|
114
|
-
* @param [o] Conversion options
|
|
115
|
-
* @returns Plain object
|
|
116
|
-
*/
|
|
117
|
-
public static toObject(m: FetchResponse, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Converts this FetchResponse to JSON.
|
|
121
|
-
* @returns JSON object
|
|
122
|
-
*/
|
|
123
|
-
public toJSON(): { [k: string]: any };
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export namespace FetchResponse {
|
|
127
|
-
|
|
128
|
-
/** StatusCode enum. */
|
|
129
|
-
enum StatusCode {
|
|
130
|
-
OK = 0,
|
|
131
|
-
NOT_FOUND = 1,
|
|
132
|
-
ERROR = 2
|
|
133
|
-
}
|
|
134
|
-
}
|
package/src/fetch/pb/proto.js
DELETED
|
@@ -1,331 +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-fetch"] || ($protobuf.roots["libp2p-fetch"] = {});
|
|
9
|
-
|
|
10
|
-
export const FetchRequest = $root.FetchRequest = (() => {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Properties of a FetchRequest.
|
|
14
|
-
* @exports IFetchRequest
|
|
15
|
-
* @interface IFetchRequest
|
|
16
|
-
* @property {string|null} [identifier] FetchRequest identifier
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Constructs a new FetchRequest.
|
|
21
|
-
* @exports FetchRequest
|
|
22
|
-
* @classdesc Represents a FetchRequest.
|
|
23
|
-
* @implements IFetchRequest
|
|
24
|
-
* @constructor
|
|
25
|
-
* @param {IFetchRequest=} [p] Properties to set
|
|
26
|
-
*/
|
|
27
|
-
function FetchRequest(p) {
|
|
28
|
-
if (p)
|
|
29
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
30
|
-
if (p[ks[i]] != null)
|
|
31
|
-
this[ks[i]] = p[ks[i]];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* FetchRequest identifier.
|
|
36
|
-
* @member {string} identifier
|
|
37
|
-
* @memberof FetchRequest
|
|
38
|
-
* @instance
|
|
39
|
-
*/
|
|
40
|
-
FetchRequest.prototype.identifier = "";
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Encodes the specified FetchRequest message. Does not implicitly {@link FetchRequest.verify|verify} messages.
|
|
44
|
-
* @function encode
|
|
45
|
-
* @memberof FetchRequest
|
|
46
|
-
* @static
|
|
47
|
-
* @param {IFetchRequest} m FetchRequest message or plain object to encode
|
|
48
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
49
|
-
* @returns {$protobuf.Writer} Writer
|
|
50
|
-
*/
|
|
51
|
-
FetchRequest.encode = function encode(m, w) {
|
|
52
|
-
if (!w)
|
|
53
|
-
w = $Writer.create();
|
|
54
|
-
if (m.identifier != null && Object.hasOwnProperty.call(m, "identifier"))
|
|
55
|
-
w.uint32(10).string(m.identifier);
|
|
56
|
-
return w;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Decodes a FetchRequest message from the specified reader or buffer.
|
|
61
|
-
* @function decode
|
|
62
|
-
* @memberof FetchRequest
|
|
63
|
-
* @static
|
|
64
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
65
|
-
* @param {number} [l] Message length if known beforehand
|
|
66
|
-
* @returns {FetchRequest} FetchRequest
|
|
67
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
68
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
69
|
-
*/
|
|
70
|
-
FetchRequest.decode = function decode(r, l) {
|
|
71
|
-
if (!(r instanceof $Reader))
|
|
72
|
-
r = $Reader.create(r);
|
|
73
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.FetchRequest();
|
|
74
|
-
while (r.pos < c) {
|
|
75
|
-
var t = r.uint32();
|
|
76
|
-
switch (t >>> 3) {
|
|
77
|
-
case 1:
|
|
78
|
-
m.identifier = r.string();
|
|
79
|
-
break;
|
|
80
|
-
default:
|
|
81
|
-
r.skipType(t & 7);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return m;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Creates a FetchRequest message from a plain object. Also converts values to their respective internal types.
|
|
90
|
-
* @function fromObject
|
|
91
|
-
* @memberof FetchRequest
|
|
92
|
-
* @static
|
|
93
|
-
* @param {Object.<string,*>} d Plain object
|
|
94
|
-
* @returns {FetchRequest} FetchRequest
|
|
95
|
-
*/
|
|
96
|
-
FetchRequest.fromObject = function fromObject(d) {
|
|
97
|
-
if (d instanceof $root.FetchRequest)
|
|
98
|
-
return d;
|
|
99
|
-
var m = new $root.FetchRequest();
|
|
100
|
-
if (d.identifier != null) {
|
|
101
|
-
m.identifier = String(d.identifier);
|
|
102
|
-
}
|
|
103
|
-
return m;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Creates a plain object from a FetchRequest message. Also converts values to other types if specified.
|
|
108
|
-
* @function toObject
|
|
109
|
-
* @memberof FetchRequest
|
|
110
|
-
* @static
|
|
111
|
-
* @param {FetchRequest} m FetchRequest
|
|
112
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
113
|
-
* @returns {Object.<string,*>} Plain object
|
|
114
|
-
*/
|
|
115
|
-
FetchRequest.toObject = function toObject(m, o) {
|
|
116
|
-
if (!o)
|
|
117
|
-
o = {};
|
|
118
|
-
var d = {};
|
|
119
|
-
if (o.defaults) {
|
|
120
|
-
d.identifier = "";
|
|
121
|
-
}
|
|
122
|
-
if (m.identifier != null && m.hasOwnProperty("identifier")) {
|
|
123
|
-
d.identifier = m.identifier;
|
|
124
|
-
}
|
|
125
|
-
return d;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Converts this FetchRequest to JSON.
|
|
130
|
-
* @function toJSON
|
|
131
|
-
* @memberof FetchRequest
|
|
132
|
-
* @instance
|
|
133
|
-
* @returns {Object.<string,*>} JSON object
|
|
134
|
-
*/
|
|
135
|
-
FetchRequest.prototype.toJSON = function toJSON() {
|
|
136
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
return FetchRequest;
|
|
140
|
-
})();
|
|
141
|
-
|
|
142
|
-
export const FetchResponse = $root.FetchResponse = (() => {
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Properties of a FetchResponse.
|
|
146
|
-
* @exports IFetchResponse
|
|
147
|
-
* @interface IFetchResponse
|
|
148
|
-
* @property {FetchResponse.StatusCode|null} [status] FetchResponse status
|
|
149
|
-
* @property {Uint8Array|null} [data] FetchResponse data
|
|
150
|
-
*/
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Constructs a new FetchResponse.
|
|
154
|
-
* @exports FetchResponse
|
|
155
|
-
* @classdesc Represents a FetchResponse.
|
|
156
|
-
* @implements IFetchResponse
|
|
157
|
-
* @constructor
|
|
158
|
-
* @param {IFetchResponse=} [p] Properties to set
|
|
159
|
-
*/
|
|
160
|
-
function FetchResponse(p) {
|
|
161
|
-
if (p)
|
|
162
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
163
|
-
if (p[ks[i]] != null)
|
|
164
|
-
this[ks[i]] = p[ks[i]];
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* FetchResponse status.
|
|
169
|
-
* @member {FetchResponse.StatusCode} status
|
|
170
|
-
* @memberof FetchResponse
|
|
171
|
-
* @instance
|
|
172
|
-
*/
|
|
173
|
-
FetchResponse.prototype.status = 0;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* FetchResponse data.
|
|
177
|
-
* @member {Uint8Array} data
|
|
178
|
-
* @memberof FetchResponse
|
|
179
|
-
* @instance
|
|
180
|
-
*/
|
|
181
|
-
FetchResponse.prototype.data = $util.newBuffer([]);
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Encodes the specified FetchResponse message. Does not implicitly {@link FetchResponse.verify|verify} messages.
|
|
185
|
-
* @function encode
|
|
186
|
-
* @memberof FetchResponse
|
|
187
|
-
* @static
|
|
188
|
-
* @param {IFetchResponse} m FetchResponse message or plain object to encode
|
|
189
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
190
|
-
* @returns {$protobuf.Writer} Writer
|
|
191
|
-
*/
|
|
192
|
-
FetchResponse.encode = function encode(m, w) {
|
|
193
|
-
if (!w)
|
|
194
|
-
w = $Writer.create();
|
|
195
|
-
if (m.status != null && Object.hasOwnProperty.call(m, "status"))
|
|
196
|
-
w.uint32(8).int32(m.status);
|
|
197
|
-
if (m.data != null && Object.hasOwnProperty.call(m, "data"))
|
|
198
|
-
w.uint32(18).bytes(m.data);
|
|
199
|
-
return w;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Decodes a FetchResponse message from the specified reader or buffer.
|
|
204
|
-
* @function decode
|
|
205
|
-
* @memberof FetchResponse
|
|
206
|
-
* @static
|
|
207
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
208
|
-
* @param {number} [l] Message length if known beforehand
|
|
209
|
-
* @returns {FetchResponse} FetchResponse
|
|
210
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
211
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
212
|
-
*/
|
|
213
|
-
FetchResponse.decode = function decode(r, l) {
|
|
214
|
-
if (!(r instanceof $Reader))
|
|
215
|
-
r = $Reader.create(r);
|
|
216
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.FetchResponse();
|
|
217
|
-
while (r.pos < c) {
|
|
218
|
-
var t = r.uint32();
|
|
219
|
-
switch (t >>> 3) {
|
|
220
|
-
case 1:
|
|
221
|
-
m.status = r.int32();
|
|
222
|
-
break;
|
|
223
|
-
case 2:
|
|
224
|
-
m.data = r.bytes();
|
|
225
|
-
break;
|
|
226
|
-
default:
|
|
227
|
-
r.skipType(t & 7);
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return m;
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Creates a FetchResponse message from a plain object. Also converts values to their respective internal types.
|
|
236
|
-
* @function fromObject
|
|
237
|
-
* @memberof FetchResponse
|
|
238
|
-
* @static
|
|
239
|
-
* @param {Object.<string,*>} d Plain object
|
|
240
|
-
* @returns {FetchResponse} FetchResponse
|
|
241
|
-
*/
|
|
242
|
-
FetchResponse.fromObject = function fromObject(d) {
|
|
243
|
-
if (d instanceof $root.FetchResponse)
|
|
244
|
-
return d;
|
|
245
|
-
var m = new $root.FetchResponse();
|
|
246
|
-
switch (d.status) {
|
|
247
|
-
case "OK":
|
|
248
|
-
case 0:
|
|
249
|
-
m.status = 0;
|
|
250
|
-
break;
|
|
251
|
-
case "NOT_FOUND":
|
|
252
|
-
case 1:
|
|
253
|
-
m.status = 1;
|
|
254
|
-
break;
|
|
255
|
-
case "ERROR":
|
|
256
|
-
case 2:
|
|
257
|
-
m.status = 2;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
if (d.data != null) {
|
|
261
|
-
if (typeof d.data === "string")
|
|
262
|
-
$util.base64.decode(d.data, m.data = $util.newBuffer($util.base64.length(d.data)), 0);
|
|
263
|
-
else if (d.data.length)
|
|
264
|
-
m.data = d.data;
|
|
265
|
-
}
|
|
266
|
-
return m;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Creates a plain object from a FetchResponse message. Also converts values to other types if specified.
|
|
271
|
-
* @function toObject
|
|
272
|
-
* @memberof FetchResponse
|
|
273
|
-
* @static
|
|
274
|
-
* @param {FetchResponse} m FetchResponse
|
|
275
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
276
|
-
* @returns {Object.<string,*>} Plain object
|
|
277
|
-
*/
|
|
278
|
-
FetchResponse.toObject = function toObject(m, o) {
|
|
279
|
-
if (!o)
|
|
280
|
-
o = {};
|
|
281
|
-
var d = {};
|
|
282
|
-
if (o.defaults) {
|
|
283
|
-
d.status = o.enums === String ? "OK" : 0;
|
|
284
|
-
if (o.bytes === String)
|
|
285
|
-
d.data = "";
|
|
286
|
-
else {
|
|
287
|
-
d.data = [];
|
|
288
|
-
if (o.bytes !== Array)
|
|
289
|
-
d.data = $util.newBuffer(d.data);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
if (m.status != null && m.hasOwnProperty("status")) {
|
|
293
|
-
d.status = o.enums === String ? $root.FetchResponse.StatusCode[m.status] : m.status;
|
|
294
|
-
}
|
|
295
|
-
if (m.data != null && m.hasOwnProperty("data")) {
|
|
296
|
-
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;
|
|
297
|
-
}
|
|
298
|
-
return d;
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Converts this FetchResponse to JSON.
|
|
303
|
-
* @function toJSON
|
|
304
|
-
* @memberof FetchResponse
|
|
305
|
-
* @instance
|
|
306
|
-
* @returns {Object.<string,*>} JSON object
|
|
307
|
-
*/
|
|
308
|
-
FetchResponse.prototype.toJSON = function toJSON() {
|
|
309
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* StatusCode enum.
|
|
314
|
-
* @name FetchResponse.StatusCode
|
|
315
|
-
* @enum {number}
|
|
316
|
-
* @property {number} OK=0 OK value
|
|
317
|
-
* @property {number} NOT_FOUND=1 NOT_FOUND value
|
|
318
|
-
* @property {number} ERROR=2 ERROR value
|
|
319
|
-
*/
|
|
320
|
-
FetchResponse.StatusCode = (function() {
|
|
321
|
-
const valuesById = {}, values = Object.create(valuesById);
|
|
322
|
-
values[valuesById[0] = "OK"] = 0;
|
|
323
|
-
values[valuesById[1] = "NOT_FOUND"] = 1;
|
|
324
|
-
values[valuesById[2] = "ERROR"] = 2;
|
|
325
|
-
return values;
|
|
326
|
-
})();
|
|
327
|
-
|
|
328
|
-
return FetchResponse;
|
|
329
|
-
})();
|
|
330
|
-
|
|
331
|
-
export { $root as default };
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import * as $protobuf from "protobufjs";
|
|
2
|
-
/** Properties of an Identify. */
|
|
3
|
-
export interface IIdentify {
|
|
4
|
-
|
|
5
|
-
/** Identify protocolVersion */
|
|
6
|
-
protocolVersion?: (string|null);
|
|
7
|
-
|
|
8
|
-
/** Identify agentVersion */
|
|
9
|
-
agentVersion?: (string|null);
|
|
10
|
-
|
|
11
|
-
/** Identify publicKey */
|
|
12
|
-
publicKey?: (Uint8Array|null);
|
|
13
|
-
|
|
14
|
-
/** Identify listenAddrs */
|
|
15
|
-
listenAddrs?: (Uint8Array[]|null);
|
|
16
|
-
|
|
17
|
-
/** Identify observedAddr */
|
|
18
|
-
observedAddr?: (Uint8Array|null);
|
|
19
|
-
|
|
20
|
-
/** Identify protocols */
|
|
21
|
-
protocols?: (string[]|null);
|
|
22
|
-
|
|
23
|
-
/** Identify signedPeerRecord */
|
|
24
|
-
signedPeerRecord?: (Uint8Array|null);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/** Represents an Identify. */
|
|
28
|
-
export class Identify implements IIdentify {
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Constructs a new Identify.
|
|
32
|
-
* @param [p] Properties to set
|
|
33
|
-
*/
|
|
34
|
-
constructor(p?: IIdentify);
|
|
35
|
-
|
|
36
|
-
/** Identify protocolVersion. */
|
|
37
|
-
public protocolVersion?: (string|null);
|
|
38
|
-
|
|
39
|
-
/** Identify agentVersion. */
|
|
40
|
-
public agentVersion?: (string|null);
|
|
41
|
-
|
|
42
|
-
/** Identify publicKey. */
|
|
43
|
-
public publicKey?: (Uint8Array|null);
|
|
44
|
-
|
|
45
|
-
/** Identify listenAddrs. */
|
|
46
|
-
public listenAddrs: Uint8Array[];
|
|
47
|
-
|
|
48
|
-
/** Identify observedAddr. */
|
|
49
|
-
public observedAddr?: (Uint8Array|null);
|
|
50
|
-
|
|
51
|
-
/** Identify protocols. */
|
|
52
|
-
public protocols: string[];
|
|
53
|
-
|
|
54
|
-
/** Identify signedPeerRecord. */
|
|
55
|
-
public signedPeerRecord?: (Uint8Array|null);
|
|
56
|
-
|
|
57
|
-
/** Identify _protocolVersion. */
|
|
58
|
-
public _protocolVersion?: "protocolVersion";
|
|
59
|
-
|
|
60
|
-
/** Identify _agentVersion. */
|
|
61
|
-
public _agentVersion?: "agentVersion";
|
|
62
|
-
|
|
63
|
-
/** Identify _publicKey. */
|
|
64
|
-
public _publicKey?: "publicKey";
|
|
65
|
-
|
|
66
|
-
/** Identify _observedAddr. */
|
|
67
|
-
public _observedAddr?: "observedAddr";
|
|
68
|
-
|
|
69
|
-
/** Identify _signedPeerRecord. */
|
|
70
|
-
public _signedPeerRecord?: "signedPeerRecord";
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Encodes the specified Identify message. Does not implicitly {@link Identify.verify|verify} messages.
|
|
74
|
-
* @param m Identify message or plain object to encode
|
|
75
|
-
* @param [w] Writer to encode to
|
|
76
|
-
* @returns Writer
|
|
77
|
-
*/
|
|
78
|
-
public static encode(m: IIdentify, w?: $protobuf.Writer): $protobuf.Writer;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Decodes an Identify message from the specified reader or buffer.
|
|
82
|
-
* @param r Reader or buffer to decode from
|
|
83
|
-
* @param [l] Message length if known beforehand
|
|
84
|
-
* @returns Identify
|
|
85
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
86
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
87
|
-
*/
|
|
88
|
-
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Identify;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Creates an Identify message from a plain object. Also converts values to their respective internal types.
|
|
92
|
-
* @param d Plain object
|
|
93
|
-
* @returns Identify
|
|
94
|
-
*/
|
|
95
|
-
public static fromObject(d: { [k: string]: any }): Identify;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Creates a plain object from an Identify message. Also converts values to other types if specified.
|
|
99
|
-
* @param m Identify
|
|
100
|
-
* @param [o] Conversion options
|
|
101
|
-
* @returns Plain object
|
|
102
|
-
*/
|
|
103
|
-
public static toObject(m: Identify, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Converts this Identify to JSON.
|
|
107
|
-
* @returns JSON object
|
|
108
|
-
*/
|
|
109
|
-
public toJSON(): { [k: string]: any };
|
|
110
|
-
}
|