@libp2p/daemon-protocol 1.0.2 → 1.0.5
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 +2 -2
- package/dist/src/index.d.ts +83 -82
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +290 -186
- package/dist/src/index.js.map +1 -1
- package/package.json +5 -4
- package/src/index.ts +327 -222
package/dist/src/index.js
CHANGED
|
@@ -1,84 +1,185 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
3
|
import { enumeration, encodeMessage, decodeMessage, message, bytes, int64, string, int32 } from 'protons-runtime';
|
|
4
|
+
export var Request;
|
|
5
|
+
(function (Request) {
|
|
6
|
+
let Type;
|
|
7
|
+
(function (Type) {
|
|
8
|
+
Type["IDENTIFY"] = "IDENTIFY";
|
|
9
|
+
Type["CONNECT"] = "CONNECT";
|
|
10
|
+
Type["STREAM_OPEN"] = "STREAM_OPEN";
|
|
11
|
+
Type["STREAM_HANDLER"] = "STREAM_HANDLER";
|
|
12
|
+
Type["DHT"] = "DHT";
|
|
13
|
+
Type["LIST_PEERS"] = "LIST_PEERS";
|
|
14
|
+
Type["CONNMANAGER"] = "CONNMANAGER";
|
|
15
|
+
Type["DISCONNECT"] = "DISCONNECT";
|
|
16
|
+
Type["PUBSUB"] = "PUBSUB";
|
|
17
|
+
Type["PEERSTORE"] = "PEERSTORE";
|
|
18
|
+
})(Type = Request.Type || (Request.Type = {}));
|
|
19
|
+
let __TypeValues;
|
|
20
|
+
(function (__TypeValues) {
|
|
21
|
+
__TypeValues[__TypeValues["IDENTIFY"] = 0] = "IDENTIFY";
|
|
22
|
+
__TypeValues[__TypeValues["CONNECT"] = 1] = "CONNECT";
|
|
23
|
+
__TypeValues[__TypeValues["STREAM_OPEN"] = 2] = "STREAM_OPEN";
|
|
24
|
+
__TypeValues[__TypeValues["STREAM_HANDLER"] = 3] = "STREAM_HANDLER";
|
|
25
|
+
__TypeValues[__TypeValues["DHT"] = 4] = "DHT";
|
|
26
|
+
__TypeValues[__TypeValues["LIST_PEERS"] = 5] = "LIST_PEERS";
|
|
27
|
+
__TypeValues[__TypeValues["CONNMANAGER"] = 6] = "CONNMANAGER";
|
|
28
|
+
__TypeValues[__TypeValues["DISCONNECT"] = 7] = "DISCONNECT";
|
|
29
|
+
__TypeValues[__TypeValues["PUBSUB"] = 8] = "PUBSUB";
|
|
30
|
+
__TypeValues[__TypeValues["PEERSTORE"] = 9] = "PEERSTORE";
|
|
31
|
+
})(__TypeValues || (__TypeValues = {}));
|
|
32
|
+
(function (Type) {
|
|
33
|
+
Type.codec = () => {
|
|
34
|
+
return enumeration(__TypeValues);
|
|
35
|
+
};
|
|
36
|
+
})(Type = Request.Type || (Request.Type = {}));
|
|
37
|
+
Request.codec = () => {
|
|
38
|
+
return message({
|
|
39
|
+
1: { name: 'type', codec: Request.Type.codec() },
|
|
40
|
+
2: { name: 'connect', codec: ConnectRequest.codec(), optional: true },
|
|
41
|
+
3: { name: 'streamOpen', codec: StreamOpenRequest.codec(), optional: true },
|
|
42
|
+
4: { name: 'streamHandler', codec: StreamHandlerRequest.codec(), optional: true },
|
|
43
|
+
5: { name: 'dht', codec: DHTRequest.codec(), optional: true },
|
|
44
|
+
6: { name: 'connManager', codec: ConnManagerRequest.codec(), optional: true },
|
|
45
|
+
7: { name: 'disconnect', codec: DisconnectRequest.codec(), optional: true },
|
|
46
|
+
8: { name: 'pubsub', codec: PSRequest.codec(), optional: true },
|
|
47
|
+
9: { name: 'peerStore', codec: PeerstoreRequest.codec(), optional: true }
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
Request.encode = (obj) => {
|
|
51
|
+
return encodeMessage(obj, Request.codec());
|
|
52
|
+
};
|
|
53
|
+
Request.decode = (buf) => {
|
|
54
|
+
return decodeMessage(buf, Request.codec());
|
|
55
|
+
};
|
|
56
|
+
})(Request || (Request = {}));
|
|
57
|
+
export var Response;
|
|
58
|
+
(function (Response) {
|
|
59
|
+
let Type;
|
|
60
|
+
(function (Type) {
|
|
61
|
+
Type["OK"] = "OK";
|
|
62
|
+
Type["ERROR"] = "ERROR";
|
|
63
|
+
})(Type = Response.Type || (Response.Type = {}));
|
|
64
|
+
let __TypeValues;
|
|
65
|
+
(function (__TypeValues) {
|
|
66
|
+
__TypeValues[__TypeValues["OK"] = 0] = "OK";
|
|
67
|
+
__TypeValues[__TypeValues["ERROR"] = 1] = "ERROR";
|
|
68
|
+
})(__TypeValues || (__TypeValues = {}));
|
|
69
|
+
(function (Type) {
|
|
70
|
+
Type.codec = () => {
|
|
71
|
+
return enumeration(__TypeValues);
|
|
72
|
+
};
|
|
73
|
+
})(Type = Response.Type || (Response.Type = {}));
|
|
74
|
+
Response.codec = () => {
|
|
75
|
+
return message({
|
|
76
|
+
1: { name: 'type', codec: Response.Type.codec() },
|
|
77
|
+
2: { name: 'error', codec: ErrorResponse.codec(), optional: true },
|
|
78
|
+
3: { name: 'streamInfo', codec: StreamInfo.codec(), optional: true },
|
|
79
|
+
4: { name: 'identify', codec: IdentifyResponse.codec(), optional: true },
|
|
80
|
+
5: { name: 'dht', codec: DHTResponse.codec(), optional: true },
|
|
81
|
+
6: { name: 'peers', codec: PeerInfo.codec(), repeats: true },
|
|
82
|
+
7: { name: 'pubsub', codec: PSResponse.codec(), optional: true },
|
|
83
|
+
8: { name: 'peerStore', codec: PeerstoreResponse.codec(), optional: true }
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
Response.encode = (obj) => {
|
|
87
|
+
return encodeMessage(obj, Response.codec());
|
|
88
|
+
};
|
|
89
|
+
Response.decode = (buf) => {
|
|
90
|
+
return decodeMessage(buf, Response.codec());
|
|
91
|
+
};
|
|
92
|
+
})(Response || (Response = {}));
|
|
4
93
|
export var IdentifyResponse;
|
|
5
94
|
(function (IdentifyResponse) {
|
|
6
|
-
IdentifyResponse.codec =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
95
|
+
IdentifyResponse.codec = () => {
|
|
96
|
+
return message({
|
|
97
|
+
1: { name: 'id', codec: bytes },
|
|
98
|
+
2: { name: 'addrs', codec: bytes, repeats: true }
|
|
99
|
+
});
|
|
100
|
+
};
|
|
10
101
|
IdentifyResponse.encode = (obj) => {
|
|
11
|
-
return encodeMessage(obj, IdentifyResponse.codec);
|
|
102
|
+
return encodeMessage(obj, IdentifyResponse.codec());
|
|
12
103
|
};
|
|
13
104
|
IdentifyResponse.decode = (buf) => {
|
|
14
|
-
return decodeMessage(buf, IdentifyResponse.codec);
|
|
105
|
+
return decodeMessage(buf, IdentifyResponse.codec());
|
|
15
106
|
};
|
|
16
107
|
})(IdentifyResponse || (IdentifyResponse = {}));
|
|
17
108
|
export var ConnectRequest;
|
|
18
109
|
(function (ConnectRequest) {
|
|
19
|
-
ConnectRequest.codec =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
110
|
+
ConnectRequest.codec = () => {
|
|
111
|
+
return message({
|
|
112
|
+
1: { name: 'peer', codec: bytes },
|
|
113
|
+
2: { name: 'addrs', codec: bytes, repeats: true },
|
|
114
|
+
3: { name: 'timeout', codec: int64, optional: true }
|
|
115
|
+
});
|
|
116
|
+
};
|
|
24
117
|
ConnectRequest.encode = (obj) => {
|
|
25
|
-
return encodeMessage(obj, ConnectRequest.codec);
|
|
118
|
+
return encodeMessage(obj, ConnectRequest.codec());
|
|
26
119
|
};
|
|
27
120
|
ConnectRequest.decode = (buf) => {
|
|
28
|
-
return decodeMessage(buf, ConnectRequest.codec);
|
|
121
|
+
return decodeMessage(buf, ConnectRequest.codec());
|
|
29
122
|
};
|
|
30
123
|
})(ConnectRequest || (ConnectRequest = {}));
|
|
31
124
|
export var StreamOpenRequest;
|
|
32
125
|
(function (StreamOpenRequest) {
|
|
33
|
-
StreamOpenRequest.codec =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
126
|
+
StreamOpenRequest.codec = () => {
|
|
127
|
+
return message({
|
|
128
|
+
1: { name: 'peer', codec: bytes },
|
|
129
|
+
2: { name: 'proto', codec: string, repeats: true },
|
|
130
|
+
3: { name: 'timeout', codec: int64, optional: true }
|
|
131
|
+
});
|
|
132
|
+
};
|
|
38
133
|
StreamOpenRequest.encode = (obj) => {
|
|
39
|
-
return encodeMessage(obj, StreamOpenRequest.codec);
|
|
134
|
+
return encodeMessage(obj, StreamOpenRequest.codec());
|
|
40
135
|
};
|
|
41
136
|
StreamOpenRequest.decode = (buf) => {
|
|
42
|
-
return decodeMessage(buf, StreamOpenRequest.codec);
|
|
137
|
+
return decodeMessage(buf, StreamOpenRequest.codec());
|
|
43
138
|
};
|
|
44
139
|
})(StreamOpenRequest || (StreamOpenRequest = {}));
|
|
45
140
|
export var StreamHandlerRequest;
|
|
46
141
|
(function (StreamHandlerRequest) {
|
|
47
|
-
StreamHandlerRequest.codec =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
142
|
+
StreamHandlerRequest.codec = () => {
|
|
143
|
+
return message({
|
|
144
|
+
1: { name: 'addr', codec: bytes },
|
|
145
|
+
2: { name: 'proto', codec: string, repeats: true }
|
|
146
|
+
});
|
|
147
|
+
};
|
|
51
148
|
StreamHandlerRequest.encode = (obj) => {
|
|
52
|
-
return encodeMessage(obj, StreamHandlerRequest.codec);
|
|
149
|
+
return encodeMessage(obj, StreamHandlerRequest.codec());
|
|
53
150
|
};
|
|
54
151
|
StreamHandlerRequest.decode = (buf) => {
|
|
55
|
-
return decodeMessage(buf, StreamHandlerRequest.codec);
|
|
152
|
+
return decodeMessage(buf, StreamHandlerRequest.codec());
|
|
56
153
|
};
|
|
57
154
|
})(StreamHandlerRequest || (StreamHandlerRequest = {}));
|
|
58
155
|
export var ErrorResponse;
|
|
59
156
|
(function (ErrorResponse) {
|
|
60
|
-
ErrorResponse.codec =
|
|
61
|
-
|
|
62
|
-
|
|
157
|
+
ErrorResponse.codec = () => {
|
|
158
|
+
return message({
|
|
159
|
+
1: { name: 'msg', codec: string }
|
|
160
|
+
});
|
|
161
|
+
};
|
|
63
162
|
ErrorResponse.encode = (obj) => {
|
|
64
|
-
return encodeMessage(obj, ErrorResponse.codec);
|
|
163
|
+
return encodeMessage(obj, ErrorResponse.codec());
|
|
65
164
|
};
|
|
66
165
|
ErrorResponse.decode = (buf) => {
|
|
67
|
-
return decodeMessage(buf, ErrorResponse.codec);
|
|
166
|
+
return decodeMessage(buf, ErrorResponse.codec());
|
|
68
167
|
};
|
|
69
168
|
})(ErrorResponse || (ErrorResponse = {}));
|
|
70
169
|
export var StreamInfo;
|
|
71
170
|
(function (StreamInfo) {
|
|
72
|
-
StreamInfo.codec =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
171
|
+
StreamInfo.codec = () => {
|
|
172
|
+
return message({
|
|
173
|
+
1: { name: 'peer', codec: bytes },
|
|
174
|
+
2: { name: 'addr', codec: bytes },
|
|
175
|
+
3: { name: 'proto', codec: string }
|
|
176
|
+
});
|
|
177
|
+
};
|
|
77
178
|
StreamInfo.encode = (obj) => {
|
|
78
|
-
return encodeMessage(obj, StreamInfo.codec);
|
|
179
|
+
return encodeMessage(obj, StreamInfo.codec());
|
|
79
180
|
};
|
|
80
181
|
StreamInfo.decode = (buf) => {
|
|
81
|
-
return decodeMessage(buf, StreamInfo.codec);
|
|
182
|
+
return decodeMessage(buf, StreamInfo.codec());
|
|
82
183
|
};
|
|
83
184
|
})(StreamInfo || (StreamInfo = {}));
|
|
84
185
|
export var DHTRequest;
|
|
@@ -95,38 +196,41 @@ export var DHTRequest;
|
|
|
95
196
|
Type["PUT_VALUE"] = "PUT_VALUE";
|
|
96
197
|
Type["PROVIDE"] = "PROVIDE";
|
|
97
198
|
})(Type = DHTRequest.Type || (DHTRequest.Type = {}));
|
|
199
|
+
let __TypeValues;
|
|
200
|
+
(function (__TypeValues) {
|
|
201
|
+
__TypeValues[__TypeValues["FIND_PEER"] = 0] = "FIND_PEER";
|
|
202
|
+
__TypeValues[__TypeValues["FIND_PEERS_CONNECTED_TO_PEER"] = 1] = "FIND_PEERS_CONNECTED_TO_PEER";
|
|
203
|
+
__TypeValues[__TypeValues["FIND_PROVIDERS"] = 2] = "FIND_PROVIDERS";
|
|
204
|
+
__TypeValues[__TypeValues["GET_CLOSEST_PEERS"] = 3] = "GET_CLOSEST_PEERS";
|
|
205
|
+
__TypeValues[__TypeValues["GET_PUBLIC_KEY"] = 4] = "GET_PUBLIC_KEY";
|
|
206
|
+
__TypeValues[__TypeValues["GET_VALUE"] = 5] = "GET_VALUE";
|
|
207
|
+
__TypeValues[__TypeValues["SEARCH_VALUE"] = 6] = "SEARCH_VALUE";
|
|
208
|
+
__TypeValues[__TypeValues["PUT_VALUE"] = 7] = "PUT_VALUE";
|
|
209
|
+
__TypeValues[__TypeValues["PROVIDE"] = 8] = "PROVIDE";
|
|
210
|
+
})(__TypeValues || (__TypeValues = {}));
|
|
98
211
|
(function (Type) {
|
|
99
|
-
Type.codec =
|
|
212
|
+
Type.codec = () => {
|
|
213
|
+
return enumeration(__TypeValues);
|
|
214
|
+
};
|
|
100
215
|
})(Type = DHTRequest.Type || (DHTRequest.Type = {}));
|
|
101
|
-
DHTRequest.codec =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
216
|
+
DHTRequest.codec = () => {
|
|
217
|
+
return message({
|
|
218
|
+
1: { name: 'type', codec: DHTRequest.Type.codec() },
|
|
219
|
+
2: { name: 'peer', codec: bytes, optional: true },
|
|
220
|
+
3: { name: 'cid', codec: bytes, optional: true },
|
|
221
|
+
4: { name: 'key', codec: bytes, optional: true },
|
|
222
|
+
5: { name: 'value', codec: bytes, optional: true },
|
|
223
|
+
6: { name: 'count', codec: int32, optional: true },
|
|
224
|
+
7: { name: 'timeout', codec: int64, optional: true }
|
|
225
|
+
});
|
|
226
|
+
};
|
|
110
227
|
DHTRequest.encode = (obj) => {
|
|
111
|
-
return encodeMessage(obj, DHTRequest.codec);
|
|
228
|
+
return encodeMessage(obj, DHTRequest.codec());
|
|
112
229
|
};
|
|
113
230
|
DHTRequest.decode = (buf) => {
|
|
114
|
-
return decodeMessage(buf, DHTRequest.codec);
|
|
231
|
+
return decodeMessage(buf, DHTRequest.codec());
|
|
115
232
|
};
|
|
116
233
|
})(DHTRequest || (DHTRequest = {}));
|
|
117
|
-
export var PeerInfo;
|
|
118
|
-
(function (PeerInfo) {
|
|
119
|
-
PeerInfo.codec = message({
|
|
120
|
-
1: { name: 'id', codec: bytes },
|
|
121
|
-
2: { name: 'addrs', codec: bytes, repeats: true }
|
|
122
|
-
});
|
|
123
|
-
PeerInfo.encode = (obj) => {
|
|
124
|
-
return encodeMessage(obj, PeerInfo.codec);
|
|
125
|
-
};
|
|
126
|
-
PeerInfo.decode = (buf) => {
|
|
127
|
-
return decodeMessage(buf, PeerInfo.codec);
|
|
128
|
-
};
|
|
129
|
-
})(PeerInfo || (PeerInfo = {}));
|
|
130
234
|
export var DHTResponse;
|
|
131
235
|
(function (DHTResponse) {
|
|
132
236
|
let Type;
|
|
@@ -135,21 +239,46 @@ export var DHTResponse;
|
|
|
135
239
|
Type["VALUE"] = "VALUE";
|
|
136
240
|
Type["END"] = "END";
|
|
137
241
|
})(Type = DHTResponse.Type || (DHTResponse.Type = {}));
|
|
242
|
+
let __TypeValues;
|
|
243
|
+
(function (__TypeValues) {
|
|
244
|
+
__TypeValues[__TypeValues["BEGIN"] = 0] = "BEGIN";
|
|
245
|
+
__TypeValues[__TypeValues["VALUE"] = 1] = "VALUE";
|
|
246
|
+
__TypeValues[__TypeValues["END"] = 2] = "END";
|
|
247
|
+
})(__TypeValues || (__TypeValues = {}));
|
|
138
248
|
(function (Type) {
|
|
139
|
-
Type.codec =
|
|
249
|
+
Type.codec = () => {
|
|
250
|
+
return enumeration(__TypeValues);
|
|
251
|
+
};
|
|
140
252
|
})(Type = DHTResponse.Type || (DHTResponse.Type = {}));
|
|
141
|
-
DHTResponse.codec =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
253
|
+
DHTResponse.codec = () => {
|
|
254
|
+
return message({
|
|
255
|
+
1: { name: 'type', codec: DHTResponse.Type.codec() },
|
|
256
|
+
2: { name: 'peer', codec: PeerInfo.codec(), optional: true },
|
|
257
|
+
3: { name: 'value', codec: bytes, optional: true }
|
|
258
|
+
});
|
|
259
|
+
};
|
|
146
260
|
DHTResponse.encode = (obj) => {
|
|
147
|
-
return encodeMessage(obj, DHTResponse.codec);
|
|
261
|
+
return encodeMessage(obj, DHTResponse.codec());
|
|
148
262
|
};
|
|
149
263
|
DHTResponse.decode = (buf) => {
|
|
150
|
-
return decodeMessage(buf, DHTResponse.codec);
|
|
264
|
+
return decodeMessage(buf, DHTResponse.codec());
|
|
151
265
|
};
|
|
152
266
|
})(DHTResponse || (DHTResponse = {}));
|
|
267
|
+
export var PeerInfo;
|
|
268
|
+
(function (PeerInfo) {
|
|
269
|
+
PeerInfo.codec = () => {
|
|
270
|
+
return message({
|
|
271
|
+
1: { name: 'id', codec: bytes },
|
|
272
|
+
2: { name: 'addrs', codec: bytes, repeats: true }
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
PeerInfo.encode = (obj) => {
|
|
276
|
+
return encodeMessage(obj, PeerInfo.codec());
|
|
277
|
+
};
|
|
278
|
+
PeerInfo.decode = (buf) => {
|
|
279
|
+
return decodeMessage(buf, PeerInfo.codec());
|
|
280
|
+
};
|
|
281
|
+
})(PeerInfo || (PeerInfo = {}));
|
|
153
282
|
export var ConnManagerRequest;
|
|
154
283
|
(function (ConnManagerRequest) {
|
|
155
284
|
let Type;
|
|
@@ -158,32 +287,44 @@ export var ConnManagerRequest;
|
|
|
158
287
|
Type["UNTAG_PEER"] = "UNTAG_PEER";
|
|
159
288
|
Type["TRIM"] = "TRIM";
|
|
160
289
|
})(Type = ConnManagerRequest.Type || (ConnManagerRequest.Type = {}));
|
|
290
|
+
let __TypeValues;
|
|
291
|
+
(function (__TypeValues) {
|
|
292
|
+
__TypeValues[__TypeValues["TAG_PEER"] = 0] = "TAG_PEER";
|
|
293
|
+
__TypeValues[__TypeValues["UNTAG_PEER"] = 1] = "UNTAG_PEER";
|
|
294
|
+
__TypeValues[__TypeValues["TRIM"] = 2] = "TRIM";
|
|
295
|
+
})(__TypeValues || (__TypeValues = {}));
|
|
161
296
|
(function (Type) {
|
|
162
|
-
Type.codec =
|
|
297
|
+
Type.codec = () => {
|
|
298
|
+
return enumeration(__TypeValues);
|
|
299
|
+
};
|
|
163
300
|
})(Type = ConnManagerRequest.Type || (ConnManagerRequest.Type = {}));
|
|
164
|
-
ConnManagerRequest.codec =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
301
|
+
ConnManagerRequest.codec = () => {
|
|
302
|
+
return message({
|
|
303
|
+
1: { name: 'type', codec: ConnManagerRequest.Type.codec() },
|
|
304
|
+
2: { name: 'peer', codec: bytes, optional: true },
|
|
305
|
+
3: { name: 'tag', codec: string, optional: true },
|
|
306
|
+
4: { name: 'weight', codec: int64, optional: true }
|
|
307
|
+
});
|
|
308
|
+
};
|
|
170
309
|
ConnManagerRequest.encode = (obj) => {
|
|
171
|
-
return encodeMessage(obj, ConnManagerRequest.codec);
|
|
310
|
+
return encodeMessage(obj, ConnManagerRequest.codec());
|
|
172
311
|
};
|
|
173
312
|
ConnManagerRequest.decode = (buf) => {
|
|
174
|
-
return decodeMessage(buf, ConnManagerRequest.codec);
|
|
313
|
+
return decodeMessage(buf, ConnManagerRequest.codec());
|
|
175
314
|
};
|
|
176
315
|
})(ConnManagerRequest || (ConnManagerRequest = {}));
|
|
177
316
|
export var DisconnectRequest;
|
|
178
317
|
(function (DisconnectRequest) {
|
|
179
|
-
DisconnectRequest.codec =
|
|
180
|
-
|
|
181
|
-
|
|
318
|
+
DisconnectRequest.codec = () => {
|
|
319
|
+
return message({
|
|
320
|
+
1: { name: 'peer', codec: bytes }
|
|
321
|
+
});
|
|
322
|
+
};
|
|
182
323
|
DisconnectRequest.encode = (obj) => {
|
|
183
|
-
return encodeMessage(obj, DisconnectRequest.codec);
|
|
324
|
+
return encodeMessage(obj, DisconnectRequest.codec());
|
|
184
325
|
};
|
|
185
326
|
DisconnectRequest.decode = (buf) => {
|
|
186
|
-
return decodeMessage(buf, DisconnectRequest.codec);
|
|
327
|
+
return decodeMessage(buf, DisconnectRequest.codec());
|
|
187
328
|
};
|
|
188
329
|
})(DisconnectRequest || (DisconnectRequest = {}));
|
|
189
330
|
export var PSRequest;
|
|
@@ -195,49 +336,64 @@ export var PSRequest;
|
|
|
195
336
|
Type["PUBLISH"] = "PUBLISH";
|
|
196
337
|
Type["SUBSCRIBE"] = "SUBSCRIBE";
|
|
197
338
|
})(Type = PSRequest.Type || (PSRequest.Type = {}));
|
|
339
|
+
let __TypeValues;
|
|
340
|
+
(function (__TypeValues) {
|
|
341
|
+
__TypeValues[__TypeValues["GET_TOPICS"] = 0] = "GET_TOPICS";
|
|
342
|
+
__TypeValues[__TypeValues["LIST_PEERS"] = 1] = "LIST_PEERS";
|
|
343
|
+
__TypeValues[__TypeValues["PUBLISH"] = 2] = "PUBLISH";
|
|
344
|
+
__TypeValues[__TypeValues["SUBSCRIBE"] = 3] = "SUBSCRIBE";
|
|
345
|
+
})(__TypeValues || (__TypeValues = {}));
|
|
198
346
|
(function (Type) {
|
|
199
|
-
Type.codec =
|
|
347
|
+
Type.codec = () => {
|
|
348
|
+
return enumeration(__TypeValues);
|
|
349
|
+
};
|
|
200
350
|
})(Type = PSRequest.Type || (PSRequest.Type = {}));
|
|
201
|
-
PSRequest.codec =
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
351
|
+
PSRequest.codec = () => {
|
|
352
|
+
return message({
|
|
353
|
+
1: { name: 'type', codec: PSRequest.Type.codec() },
|
|
354
|
+
2: { name: 'topic', codec: string, optional: true },
|
|
355
|
+
3: { name: 'data', codec: bytes, optional: true }
|
|
356
|
+
});
|
|
357
|
+
};
|
|
206
358
|
PSRequest.encode = (obj) => {
|
|
207
|
-
return encodeMessage(obj, PSRequest.codec);
|
|
359
|
+
return encodeMessage(obj, PSRequest.codec());
|
|
208
360
|
};
|
|
209
361
|
PSRequest.decode = (buf) => {
|
|
210
|
-
return decodeMessage(buf, PSRequest.codec);
|
|
362
|
+
return decodeMessage(buf, PSRequest.codec());
|
|
211
363
|
};
|
|
212
364
|
})(PSRequest || (PSRequest = {}));
|
|
213
365
|
export var PSMessage;
|
|
214
366
|
(function (PSMessage) {
|
|
215
|
-
PSMessage.codec =
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
367
|
+
PSMessage.codec = () => {
|
|
368
|
+
return message({
|
|
369
|
+
1: { name: 'from', codec: bytes, optional: true },
|
|
370
|
+
2: { name: 'data', codec: bytes, optional: true },
|
|
371
|
+
3: { name: 'seqno', codec: bytes, optional: true },
|
|
372
|
+
4: { name: 'topicIDs', codec: string, repeats: true },
|
|
373
|
+
5: { name: 'signature', codec: bytes, optional: true },
|
|
374
|
+
6: { name: 'key', codec: bytes, optional: true }
|
|
375
|
+
});
|
|
376
|
+
};
|
|
223
377
|
PSMessage.encode = (obj) => {
|
|
224
|
-
return encodeMessage(obj, PSMessage.codec);
|
|
378
|
+
return encodeMessage(obj, PSMessage.codec());
|
|
225
379
|
};
|
|
226
380
|
PSMessage.decode = (buf) => {
|
|
227
|
-
return decodeMessage(buf, PSMessage.codec);
|
|
381
|
+
return decodeMessage(buf, PSMessage.codec());
|
|
228
382
|
};
|
|
229
383
|
})(PSMessage || (PSMessage = {}));
|
|
230
384
|
export var PSResponse;
|
|
231
385
|
(function (PSResponse) {
|
|
232
|
-
PSResponse.codec =
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
386
|
+
PSResponse.codec = () => {
|
|
387
|
+
return message({
|
|
388
|
+
1: { name: 'topics', codec: string, repeats: true },
|
|
389
|
+
2: { name: 'peerIDs', codec: bytes, repeats: true }
|
|
390
|
+
});
|
|
391
|
+
};
|
|
236
392
|
PSResponse.encode = (obj) => {
|
|
237
|
-
return encodeMessage(obj, PSResponse.codec);
|
|
393
|
+
return encodeMessage(obj, PSResponse.codec());
|
|
238
394
|
};
|
|
239
395
|
PSResponse.decode = (buf) => {
|
|
240
|
-
return decodeMessage(buf, PSResponse.codec);
|
|
396
|
+
return decodeMessage(buf, PSResponse.codec());
|
|
241
397
|
};
|
|
242
398
|
})(PSResponse || (PSResponse = {}));
|
|
243
399
|
export var PeerstoreRequest;
|
|
@@ -247,95 +403,43 @@ export var PeerstoreRequest;
|
|
|
247
403
|
Type["GET_PROTOCOLS"] = "GET_PROTOCOLS";
|
|
248
404
|
Type["GET_PEER_INFO"] = "GET_PEER_INFO";
|
|
249
405
|
})(Type = PeerstoreRequest.Type || (PeerstoreRequest.Type = {}));
|
|
406
|
+
let __TypeValues;
|
|
407
|
+
(function (__TypeValues) {
|
|
408
|
+
__TypeValues[__TypeValues["GET_PROTOCOLS"] = 1] = "GET_PROTOCOLS";
|
|
409
|
+
__TypeValues[__TypeValues["GET_PEER_INFO"] = 2] = "GET_PEER_INFO";
|
|
410
|
+
})(__TypeValues || (__TypeValues = {}));
|
|
250
411
|
(function (Type) {
|
|
251
|
-
Type.codec =
|
|
412
|
+
Type.codec = () => {
|
|
413
|
+
return enumeration(__TypeValues);
|
|
414
|
+
};
|
|
252
415
|
})(Type = PeerstoreRequest.Type || (PeerstoreRequest.Type = {}));
|
|
253
|
-
PeerstoreRequest.codec =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
416
|
+
PeerstoreRequest.codec = () => {
|
|
417
|
+
return message({
|
|
418
|
+
1: { name: 'type', codec: PeerstoreRequest.Type.codec() },
|
|
419
|
+
2: { name: 'id', codec: bytes, optional: true },
|
|
420
|
+
3: { name: 'protos', codec: string, repeats: true }
|
|
421
|
+
});
|
|
422
|
+
};
|
|
258
423
|
PeerstoreRequest.encode = (obj) => {
|
|
259
|
-
return encodeMessage(obj, PeerstoreRequest.codec);
|
|
424
|
+
return encodeMessage(obj, PeerstoreRequest.codec());
|
|
260
425
|
};
|
|
261
426
|
PeerstoreRequest.decode = (buf) => {
|
|
262
|
-
return decodeMessage(buf, PeerstoreRequest.codec);
|
|
427
|
+
return decodeMessage(buf, PeerstoreRequest.codec());
|
|
263
428
|
};
|
|
264
429
|
})(PeerstoreRequest || (PeerstoreRequest = {}));
|
|
265
430
|
export var PeerstoreResponse;
|
|
266
431
|
(function (PeerstoreResponse) {
|
|
267
|
-
PeerstoreResponse.codec =
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
432
|
+
PeerstoreResponse.codec = () => {
|
|
433
|
+
return message({
|
|
434
|
+
1: { name: 'peer', codec: PeerInfo.codec(), optional: true },
|
|
435
|
+
2: { name: 'protos', codec: string, repeats: true }
|
|
436
|
+
});
|
|
437
|
+
};
|
|
271
438
|
PeerstoreResponse.encode = (obj) => {
|
|
272
|
-
return encodeMessage(obj, PeerstoreResponse.codec);
|
|
439
|
+
return encodeMessage(obj, PeerstoreResponse.codec());
|
|
273
440
|
};
|
|
274
441
|
PeerstoreResponse.decode = (buf) => {
|
|
275
|
-
return decodeMessage(buf, PeerstoreResponse.codec);
|
|
442
|
+
return decodeMessage(buf, PeerstoreResponse.codec());
|
|
276
443
|
};
|
|
277
444
|
})(PeerstoreResponse || (PeerstoreResponse = {}));
|
|
278
|
-
export var Request;
|
|
279
|
-
(function (Request) {
|
|
280
|
-
let Type;
|
|
281
|
-
(function (Type) {
|
|
282
|
-
Type["IDENTIFY"] = "IDENTIFY";
|
|
283
|
-
Type["CONNECT"] = "CONNECT";
|
|
284
|
-
Type["STREAM_OPEN"] = "STREAM_OPEN";
|
|
285
|
-
Type["STREAM_HANDLER"] = "STREAM_HANDLER";
|
|
286
|
-
Type["DHT"] = "DHT";
|
|
287
|
-
Type["LIST_PEERS"] = "LIST_PEERS";
|
|
288
|
-
Type["CONNMANAGER"] = "CONNMANAGER";
|
|
289
|
-
Type["DISCONNECT"] = "DISCONNECT";
|
|
290
|
-
Type["PUBSUB"] = "PUBSUB";
|
|
291
|
-
Type["PEERSTORE"] = "PEERSTORE";
|
|
292
|
-
})(Type = Request.Type || (Request.Type = {}));
|
|
293
|
-
(function (Type) {
|
|
294
|
-
Type.codec = enumeration(Type);
|
|
295
|
-
})(Type = Request.Type || (Request.Type = {}));
|
|
296
|
-
Request.codec = message({
|
|
297
|
-
1: { name: 'type', codec: Request.Type.codec },
|
|
298
|
-
2: { name: 'connect', codec: ConnectRequest.codec, optional: true },
|
|
299
|
-
3: { name: 'streamOpen', codec: StreamOpenRequest.codec, optional: true },
|
|
300
|
-
4: { name: 'streamHandler', codec: StreamHandlerRequest.codec, optional: true },
|
|
301
|
-
5: { name: 'dht', codec: DHTRequest.codec, optional: true },
|
|
302
|
-
6: { name: 'connManager', codec: ConnManagerRequest.codec, optional: true },
|
|
303
|
-
7: { name: 'disconnect', codec: DisconnectRequest.codec, optional: true },
|
|
304
|
-
8: { name: 'pubsub', codec: PSRequest.codec, optional: true },
|
|
305
|
-
9: { name: 'peerStore', codec: PeerstoreRequest.codec, optional: true }
|
|
306
|
-
});
|
|
307
|
-
Request.encode = (obj) => {
|
|
308
|
-
return encodeMessage(obj, Request.codec);
|
|
309
|
-
};
|
|
310
|
-
Request.decode = (buf) => {
|
|
311
|
-
return decodeMessage(buf, Request.codec);
|
|
312
|
-
};
|
|
313
|
-
})(Request || (Request = {}));
|
|
314
|
-
export var Response;
|
|
315
|
-
(function (Response) {
|
|
316
|
-
let Type;
|
|
317
|
-
(function (Type) {
|
|
318
|
-
Type["OK"] = "OK";
|
|
319
|
-
Type["ERROR"] = "ERROR";
|
|
320
|
-
})(Type = Response.Type || (Response.Type = {}));
|
|
321
|
-
(function (Type) {
|
|
322
|
-
Type.codec = enumeration(Type);
|
|
323
|
-
})(Type = Response.Type || (Response.Type = {}));
|
|
324
|
-
Response.codec = message({
|
|
325
|
-
1: { name: 'type', codec: Response.Type.codec },
|
|
326
|
-
2: { name: 'error', codec: ErrorResponse.codec, optional: true },
|
|
327
|
-
3: { name: 'streamInfo', codec: StreamInfo.codec, optional: true },
|
|
328
|
-
4: { name: 'identify', codec: IdentifyResponse.codec, optional: true },
|
|
329
|
-
5: { name: 'dht', codec: DHTResponse.codec, optional: true },
|
|
330
|
-
6: { name: 'peers', codec: PeerInfo.codec, repeats: true },
|
|
331
|
-
7: { name: 'pubsub', codec: PSResponse.codec, optional: true },
|
|
332
|
-
8: { name: 'peerStore', codec: PeerstoreResponse.codec, optional: true }
|
|
333
|
-
});
|
|
334
|
-
Response.encode = (obj) => {
|
|
335
|
-
return encodeMessage(obj, Response.codec);
|
|
336
|
-
};
|
|
337
|
-
Response.decode = (buf) => {
|
|
338
|
-
return decodeMessage(buf, Response.codec);
|
|
339
|
-
};
|
|
340
|
-
})(Response || (Response = {}));
|
|
341
445
|
//# sourceMappingURL=index.js.map
|