@libp2p/circuit-relay-v2 2.1.5 → 3.0.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 +4 -4
- package/dist/src/constants.d.ts +0 -1
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +0 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/errors.d.ts +22 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +22 -0
- package/dist/src/errors.js.map +1 -1
- package/dist/src/transport/discovery.d.ts +1 -0
- package/dist/src/transport/discovery.d.ts.map +1 -1
- package/dist/src/transport/discovery.js +38 -8
- package/dist/src/transport/discovery.js.map +1 -1
- package/dist/src/transport/index.d.ts +0 -6
- package/dist/src/transport/index.d.ts.map +1 -1
- package/dist/src/transport/index.js.map +1 -1
- package/dist/src/transport/listener.d.ts +3 -0
- package/dist/src/transport/listener.d.ts.map +1 -1
- package/dist/src/transport/listener.js +57 -27
- package/dist/src/transport/listener.js.map +1 -1
- package/dist/src/transport/reservation-store.d.ts +37 -14
- package/dist/src/transport/reservation-store.d.ts.map +1 -1
- package/dist/src/transport/reservation-store.js +125 -80
- package/dist/src/transport/reservation-store.js.map +1 -1
- package/dist/src/transport/transport.d.ts +2 -13
- package/dist/src/transport/transport.d.ts.map +1 -1
- package/dist/src/transport/transport.js +22 -49
- package/dist/src/transport/transport.js.map +1 -1
- package/dist/src/utils.d.ts +5 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +7 -4
- package/dist/src/utils.js.map +1 -1
- package/package.json +10 -9
- package/src/constants.ts +0 -2
- package/src/errors.ts +25 -0
- package/src/transport/discovery.ts +47 -9
- package/src/transport/index.ts +0 -7
- package/src/transport/listener.ts +75 -35
- package/src/transport/reservation-store.ts +184 -102
- package/src/transport/transport.ts +25 -71
- package/src/utils.ts +12 -4
@@ -1,10 +1,13 @@
|
|
1
|
-
import { TypedEventEmitter, setMaxListeners } from '@libp2p/interface';
|
1
|
+
import { ListenError, TypedEventEmitter, setMaxListeners } from '@libp2p/interface';
|
2
2
|
import { PeerMap } from '@libp2p/peer-collections';
|
3
|
-
import {
|
3
|
+
import { createScalableCuckooFilter } from '@libp2p/utils/filters';
|
4
4
|
import { PeerQueue } from '@libp2p/utils/peer-queue';
|
5
5
|
import { multiaddr } from '@multiformats/multiaddr';
|
6
|
+
import { Circuit } from '@multiformats/multiaddr-matcher';
|
6
7
|
import { pbStream } from 'it-protobuf-stream';
|
7
|
-
import {
|
8
|
+
import { nanoid } from 'nanoid';
|
9
|
+
import { DEFAULT_MAX_RESERVATION_QUEUE_LENGTH, DEFAULT_RESERVATION_COMPLETION_TIMEOUT, DEFAULT_RESERVATION_CONCURRENCY, KEEP_ALIVE_TAG, RELAY_V2_HOP_CODEC } from '../constants.js';
|
10
|
+
import { DoubleRelayError, HadEnoughRelaysError, RelayQueueFullError } from '../errors.js';
|
8
11
|
import { HopMessage, Status } from '../pb/index.js';
|
9
12
|
import { getExpirationMilliseconds } from '../utils.js';
|
10
13
|
// allow refreshing a relay reservation if it will expire in the next 10 minutes
|
@@ -16,12 +19,11 @@ const REFRESH_TIMEOUT_MIN = 30 * 1000;
|
|
16
19
|
export class ReservationStore extends TypedEventEmitter {
|
17
20
|
peerId;
|
18
21
|
connectionManager;
|
19
|
-
transportManager;
|
20
22
|
peerStore;
|
21
23
|
events;
|
22
24
|
reserveQueue;
|
23
25
|
reservations;
|
24
|
-
|
26
|
+
pendingReservations;
|
25
27
|
maxReservationQueueLength;
|
26
28
|
reservationCompletionTimeout;
|
27
29
|
started;
|
@@ -32,15 +34,14 @@ export class ReservationStore extends TypedEventEmitter {
|
|
32
34
|
this.log = components.logger.forComponent('libp2p:circuit-relay:transport:reservation-store');
|
33
35
|
this.peerId = components.peerId;
|
34
36
|
this.connectionManager = components.connectionManager;
|
35
|
-
this.transportManager = components.transportManager;
|
36
37
|
this.peerStore = components.peerStore;
|
37
38
|
this.events = components.events;
|
38
39
|
this.reservations = new PeerMap();
|
39
|
-
this.
|
40
|
+
this.pendingReservations = [];
|
40
41
|
this.maxReservationQueueLength = init?.maxReservationQueueLength ?? DEFAULT_MAX_RESERVATION_QUEUE_LENGTH;
|
41
42
|
this.reservationCompletionTimeout = init?.reservationCompletionTimeout ?? DEFAULT_RESERVATION_COMPLETION_TIMEOUT;
|
42
43
|
this.started = false;
|
43
|
-
this.relayFilter =
|
44
|
+
this.relayFilter = createScalableCuckooFilter(100);
|
44
45
|
// ensure we don't listen on multiple relays simultaneously
|
45
46
|
this.reserveQueue = new PeerQueue({
|
46
47
|
concurrency: init?.reservationConcurrency ?? DEFAULT_RESERVATION_CONCURRENCY,
|
@@ -56,7 +57,7 @@ export class ReservationStore extends TypedEventEmitter {
|
|
56
57
|
if (reservation == null) {
|
57
58
|
return;
|
58
59
|
}
|
59
|
-
this.#removeReservation(evt.detail.remotePeer
|
60
|
+
this.#removeReservation(evt.detail.remotePeer)
|
60
61
|
.catch(err => {
|
61
62
|
this.log('could not remove relay %p - %e', evt.detail, err);
|
62
63
|
});
|
@@ -74,7 +75,7 @@ export class ReservationStore extends TypedEventEmitter {
|
|
74
75
|
.then(async () => {
|
75
76
|
const relayPeers = await this.peerStore.all({
|
76
77
|
filters: [(peer) => {
|
77
|
-
return peer.tags.has(
|
78
|
+
return peer.tags.has(KEEP_ALIVE_TAG);
|
78
79
|
}]
|
79
80
|
});
|
80
81
|
this.log('removing tag from %d old relays', relayPeers.length);
|
@@ -82,15 +83,13 @@ export class ReservationStore extends TypedEventEmitter {
|
|
82
83
|
await Promise.all(relayPeers.map(async (peer) => {
|
83
84
|
await this.peerStore.merge(peer.id, {
|
84
85
|
tags: {
|
85
|
-
[RELAY_TAG]: undefined,
|
86
86
|
[KEEP_ALIVE_TAG]: undefined
|
87
87
|
}
|
88
88
|
});
|
89
89
|
}));
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
}
|
90
|
+
this.log('redialing %d old relays', relayPeers.length);
|
91
|
+
await Promise.all(relayPeers.map(async (peer) => this.addRelay(peer.id, 'discovered')));
|
92
|
+
this.#checkReservationCount();
|
94
93
|
})
|
95
94
|
.catch(err => {
|
96
95
|
this.log.error(err);
|
@@ -104,6 +103,12 @@ export class ReservationStore extends TypedEventEmitter {
|
|
104
103
|
this.reservations.clear();
|
105
104
|
this.started = false;
|
106
105
|
}
|
106
|
+
reserveRelay() {
|
107
|
+
const id = nanoid();
|
108
|
+
this.pendingReservations.push(id);
|
109
|
+
this.#checkReservationCount();
|
110
|
+
return id;
|
111
|
+
}
|
107
112
|
/**
|
108
113
|
* If the number of current relays is beneath the configured `maxReservations`
|
109
114
|
* value, and the passed peer id is not our own, and we have a non-relayed
|
@@ -113,22 +118,21 @@ export class ReservationStore extends TypedEventEmitter {
|
|
113
118
|
async addRelay(peerId, type) {
|
114
119
|
if (this.peerId.equals(peerId)) {
|
115
120
|
this.log.trace('not trying to use self as relay');
|
116
|
-
|
121
|
+
throw new ListenError('Cannot use self as relay');
|
117
122
|
}
|
118
123
|
if (this.reserveQueue.size > this.maxReservationQueueLength) {
|
119
|
-
|
120
|
-
return;
|
124
|
+
throw new RelayQueueFullError('The reservation queue is full');
|
121
125
|
}
|
122
|
-
|
126
|
+
const existingJob = this.reserveQueue.find(peerId);
|
127
|
+
if (existingJob != null) {
|
123
128
|
this.log.trace('potential relay peer %p is already in the reservation queue', peerId);
|
124
|
-
return;
|
129
|
+
return existingJob.join();
|
125
130
|
}
|
126
131
|
if (this.relayFilter.has(peerId.toMultihash().bytes)) {
|
127
|
-
|
128
|
-
return;
|
132
|
+
throw new ListenError('The relay was previously invalid');
|
129
133
|
}
|
130
134
|
this.log.trace('try to reserve relay slot with %p', peerId);
|
131
|
-
|
135
|
+
return this.reserveQueue.add(async () => {
|
132
136
|
const start = Date.now();
|
133
137
|
try {
|
134
138
|
// allow refresh of an existing reservation if it is about to expire
|
@@ -145,27 +149,23 @@ export class ReservationStore extends TypedEventEmitter {
|
|
145
149
|
}
|
146
150
|
if (connected && getExpirationMilliseconds(existingReservation.reservation.expire) > REFRESH_WINDOW) {
|
147
151
|
this.log('already have relay reservation with %p but we are still connected and it does not expire soon', peerId);
|
148
|
-
return
|
152
|
+
return {
|
153
|
+
relay: peerId,
|
154
|
+
details: existingReservation
|
155
|
+
};
|
149
156
|
}
|
150
|
-
await this.#removeReservation(peerId
|
157
|
+
await this.#removeReservation(peerId);
|
151
158
|
}
|
152
|
-
if (type === 'discovered' &&
|
153
|
-
|
154
|
-
acc++;
|
155
|
-
}
|
156
|
-
return acc;
|
157
|
-
}, 0) >= this.maxDiscoveredRelays) {
|
158
|
-
this.log.trace('already have enough discovered relays');
|
159
|
-
return;
|
159
|
+
if (type === 'discovered' && this.pendingReservations.length === 0) {
|
160
|
+
throw new HadEnoughRelaysError('Not making reservation on discovered relay because we do not need any more relays');
|
160
161
|
}
|
161
162
|
const signal = AbortSignal.timeout(this.reservationCompletionTimeout);
|
162
163
|
setMaxListeners(Infinity, signal);
|
163
164
|
const connection = await this.connectionManager.openConnection(peerId, {
|
164
165
|
signal
|
165
166
|
});
|
166
|
-
if (connection.remoteAddr
|
167
|
-
|
168
|
-
return;
|
167
|
+
if (Circuit.matches(connection.remoteAddr)) {
|
168
|
+
throw new DoubleRelayError('not creating reservation over relayed connection');
|
169
169
|
}
|
170
170
|
const reservation = await this.#createReservation(connection, {
|
171
171
|
signal
|
@@ -180,56 +180,72 @@ export class ReservationStore extends TypedEventEmitter {
|
|
180
180
|
this.addRelay(peerId, type)
|
181
181
|
.catch(async (err) => {
|
182
182
|
this.log.error('could not refresh reservation to relay %p - %e', peerId, err);
|
183
|
-
|
184
|
-
if (reservation == null) {
|
185
|
-
this.log.error('did not have reservation after refreshing reservation failed %p', peerId);
|
186
|
-
return;
|
187
|
-
}
|
188
|
-
await this.#removeReservation(peerId, reservation);
|
183
|
+
await this.#removeReservation(peerId);
|
189
184
|
})
|
190
185
|
.catch(err => {
|
191
186
|
this.log.error('could not remove expired reservation to relay %p - %e', peerId, err);
|
192
187
|
});
|
193
188
|
}, timeoutDuration);
|
189
|
+
let res;
|
190
|
+
// assign a reservation id if one was requested
|
191
|
+
if (type === 'discovered') {
|
192
|
+
const id = this.pendingReservations.pop();
|
193
|
+
if (id == null) {
|
194
|
+
throw new HadEnoughRelaysError('Made reservation on relay but did not need any more discovered relays');
|
195
|
+
}
|
196
|
+
res = {
|
197
|
+
timeout,
|
198
|
+
reservation,
|
199
|
+
type,
|
200
|
+
connection: connection.id,
|
201
|
+
id
|
202
|
+
};
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
res = {
|
206
|
+
timeout,
|
207
|
+
reservation,
|
208
|
+
type,
|
209
|
+
connection: connection.id
|
210
|
+
};
|
211
|
+
}
|
194
212
|
// we've managed to create a reservation successfully
|
195
|
-
this.reservations.set(peerId,
|
196
|
-
timeout,
|
197
|
-
reservation,
|
198
|
-
type,
|
199
|
-
connection: connection.id
|
200
|
-
});
|
213
|
+
this.reservations.set(peerId, res);
|
201
214
|
// ensure we don't close the connection to the relay
|
202
215
|
await this.peerStore.merge(peerId, {
|
203
216
|
tags: {
|
204
|
-
[RELAY_TAG]: {
|
205
|
-
value: 1,
|
206
|
-
ttl: expiration
|
207
|
-
},
|
208
217
|
[KEEP_ALIVE_TAG]: {
|
209
218
|
value: 1,
|
210
219
|
ttl: expiration
|
211
220
|
}
|
212
221
|
}
|
213
222
|
});
|
214
|
-
//
|
215
|
-
|
223
|
+
// check to see if we have discovered enough relays
|
224
|
+
this.#checkReservationCount();
|
225
|
+
const result = {
|
226
|
+
relay: peerId,
|
227
|
+
details: res
|
228
|
+
};
|
216
229
|
this.safeDispatchEvent('relay:created-reservation', {
|
217
|
-
detail:
|
230
|
+
detail: result
|
218
231
|
});
|
232
|
+
return result;
|
219
233
|
}
|
220
234
|
catch (err) {
|
221
|
-
|
222
|
-
|
223
|
-
this.relayFilter.add(peerId.toMultihash().bytes);
|
224
|
-
// cancel the renewal timeout if it's been set
|
225
|
-
const reservation = this.reservations.get(peerId);
|
226
|
-
// if listening failed, remove the reservation
|
227
|
-
if (reservation != null) {
|
228
|
-
this.#removeReservation(peerId, reservation)
|
229
|
-
.catch(err => {
|
230
|
-
this.log.error('could not remove reservation on %p after reserving slot failed - %e', peerId, err);
|
231
|
-
});
|
235
|
+
if (!(type === 'discovered' && err.name === 'HadEnoughRelaysError')) {
|
236
|
+
this.log.error('could not reserve slot on %p after %dms - %e', peerId, Date.now() - start, err);
|
232
237
|
}
|
238
|
+
// don't try this peer again if dialing failed or they do not support
|
239
|
+
// the hop protocol
|
240
|
+
if (err.name === 'DialError' || err.name === 'UnsupportedProtocolError') {
|
241
|
+
this.relayFilter.add(peerId.toMultihash().bytes);
|
242
|
+
}
|
243
|
+
// if listening failed, remove the reservation
|
244
|
+
this.#removeReservation(peerId)
|
245
|
+
.catch(err => {
|
246
|
+
this.log.error('could not remove reservation on %p after reserving slot failed - %e', peerId, err);
|
247
|
+
});
|
248
|
+
throw err;
|
233
249
|
}
|
234
250
|
}, {
|
235
251
|
peerId
|
@@ -241,13 +257,22 @@ export class ReservationStore extends TypedEventEmitter {
|
|
241
257
|
getReservation(peerId) {
|
242
258
|
return this.reservations.get(peerId)?.reservation;
|
243
259
|
}
|
244
|
-
reservationCount() {
|
245
|
-
|
260
|
+
reservationCount(type) {
|
261
|
+
if (type == null) {
|
262
|
+
return this.reservations.size;
|
263
|
+
}
|
264
|
+
return [...this.reservations.values()].reduce((acc, curr) => {
|
265
|
+
if (curr.type === type) {
|
266
|
+
acc++;
|
267
|
+
}
|
268
|
+
return acc;
|
269
|
+
}, 0);
|
246
270
|
}
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
})
|
271
|
+
cancelReservations() {
|
272
|
+
[...this.reservations.values()].forEach(reservation => {
|
273
|
+
clearTimeout(reservation.timeout);
|
274
|
+
});
|
275
|
+
this.reservations.clear();
|
251
276
|
}
|
252
277
|
async #createReservation(connection, options) {
|
253
278
|
options.signal?.throwIfAborted();
|
@@ -255,9 +280,11 @@ export class ReservationStore extends TypedEventEmitter {
|
|
255
280
|
const stream = await connection.newStream(RELAY_V2_HOP_CODEC, options);
|
256
281
|
const pbstr = pbStream(stream);
|
257
282
|
const hopstr = pbstr.pb(HopMessage);
|
283
|
+
this.log.trace('send RESERVE to %p', connection.remotePeer);
|
258
284
|
await hopstr.write({ type: HopMessage.Type.RESERVE }, options);
|
259
285
|
let response;
|
260
286
|
try {
|
287
|
+
this.log.trace('read response from %p', connection.remotePeer);
|
261
288
|
response = await hopstr.read(options);
|
262
289
|
}
|
263
290
|
catch (err) {
|
@@ -269,6 +296,7 @@ export class ReservationStore extends TypedEventEmitter {
|
|
269
296
|
await stream.close(options);
|
270
297
|
}
|
271
298
|
}
|
299
|
+
this.log.trace('read response from %p', response);
|
272
300
|
if (response.status === Status.OK && response.reservation != null) {
|
273
301
|
// check that the returned relay has the relay address - this can be
|
274
302
|
// omitted when requesting a reservation from a go-libp2p relay we
|
@@ -294,26 +322,43 @@ export class ReservationStore extends TypedEventEmitter {
|
|
294
322
|
/**
|
295
323
|
* Remove listen relay
|
296
324
|
*/
|
297
|
-
async #removeReservation(peerId
|
298
|
-
|
299
|
-
|
325
|
+
async #removeReservation(peerId) {
|
326
|
+
const reservation = this.reservations.get(peerId);
|
327
|
+
if (reservation == null) {
|
300
328
|
return;
|
301
329
|
}
|
302
330
|
this.log('removing relay reservation with %p from local store', peerId);
|
303
331
|
clearTimeout(reservation.timeout);
|
304
332
|
this.reservations.delete(peerId);
|
333
|
+
// discover a new relay for this discovery request
|
334
|
+
if (reservation.type === 'discovered') {
|
335
|
+
this.pendingReservations.push(reservation.id);
|
336
|
+
}
|
305
337
|
// untag the relay
|
306
338
|
await this.peerStore.merge(peerId, {
|
307
339
|
tags: {
|
308
|
-
[RELAY_TAG]: undefined,
|
309
340
|
[KEEP_ALIVE_TAG]: undefined
|
310
341
|
}
|
311
342
|
});
|
312
|
-
this.safeDispatchEvent('relay:removed', {
|
313
|
-
|
314
|
-
|
315
|
-
|
343
|
+
this.safeDispatchEvent('relay:removed', {
|
344
|
+
detail: {
|
345
|
+
relay: peerId,
|
346
|
+
details: reservation
|
347
|
+
}
|
348
|
+
});
|
349
|
+
// maybe trigger discovery of new relays
|
350
|
+
this.#checkReservationCount();
|
351
|
+
}
|
352
|
+
#checkReservationCount() {
|
353
|
+
if (this.pendingReservations.length === 0) {
|
354
|
+
this.log.trace('have discovered enough relays');
|
355
|
+
this.reserveQueue.clear();
|
356
|
+
this.safeDispatchEvent('relay:found-enough-relays');
|
357
|
+
return;
|
316
358
|
}
|
359
|
+
this.relayFilter = createScalableCuckooFilter(100);
|
360
|
+
this.log('not discovered enough relays %d/%d', this.reservations.size, this.pendingReservations.length);
|
361
|
+
this.safeDispatchEvent('relay:not-enough-relays');
|
317
362
|
}
|
318
363
|
}
|
319
364
|
//# sourceMappingURL=reservation-store.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reservation-store.js","sourceRoot":"","sources":["../../../src/transport/reservation-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,oCAAoC,EAAE,sCAAsC,EAAE,+BAA+B,EAAE,cAAc,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC9L,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAMvD,gFAAgF;AAChF,MAAM,cA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C5B;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,iBAAiB,CAAC,eAAe,EAAE;YACtC,MAAM,EAAE;gBACN,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,WAAW;aACrB;SACF,CAAC,CAAA;QAEF,wCAAwC;QACxC,IAAI,CAAC,sBAAsB,EAAE,CAAA;IAC/B,CAAC;IAED,sBAAsB;QACpB,IAAI,IAAI,CAAC,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAA;YAC/C,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;YACzB,IAAI,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,CAAA;YAEnD,OAAM;QACR,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAA;QAClD,IAAI,CAAC,GAAG,CAAC,oCAAoC,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QACvG,IAAI,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAA;IACnD,CAAC;CACF"}
|
@@ -1,19 +1,10 @@
|
|
1
1
|
import { serviceCapabilities, serviceDependencies, transportSymbol } from '@libp2p/interface';
|
2
2
|
import { ReservationStore } from './reservation-store.js';
|
3
3
|
import type { CircuitRelayTransportComponents, CircuitRelayTransportInit } from './index.js';
|
4
|
-
import type { Transport, CreateListenerOptions, Listener, Connection,
|
4
|
+
import type { Transport, CreateListenerOptions, Listener, Connection, OutboundConnectionUpgradeEvents, DialTransportOptions, OpenConnectionProgressEvents } from '@libp2p/interface';
|
5
5
|
import type { IncomingStreamData } from '@libp2p/interface-internal';
|
6
6
|
import type { Multiaddr } from '@multiformats/multiaddr';
|
7
|
-
import type { ProgressEvent
|
8
|
-
interface ConnectOptions extends ProgressOptions<CircuitRelayDialEvents> {
|
9
|
-
stream: Stream;
|
10
|
-
connection: Connection;
|
11
|
-
destinationPeer: PeerId;
|
12
|
-
destinationAddr: Multiaddr;
|
13
|
-
relayAddr: Multiaddr;
|
14
|
-
ma: Multiaddr;
|
15
|
-
disconnectOnFailure: boolean;
|
16
|
-
}
|
7
|
+
import type { ProgressEvent } from 'progress-events';
|
17
8
|
export type CircuitRelayDialEvents = OutboundConnectionUpgradeEvents | OpenConnectionProgressEvents | ProgressEvent<'circuit-relay:open-connection'> | ProgressEvent<'circuit-relay:reuse-connection'> | ProgressEvent<'circuit-relay:open-hop-stream'> | ProgressEvent<'circuit-relay:write-connect-message'> | ProgressEvent<'circuit-relay:read-connect-response'>;
|
18
9
|
export declare class CircuitRelayTransport implements Transport<CircuitRelayDialEvents> {
|
19
10
|
private readonly discovery?;
|
@@ -44,7 +35,6 @@ export declare class CircuitRelayTransport implements Transport<CircuitRelayDial
|
|
44
35
|
* Dial a peer over a relay
|
45
36
|
*/
|
46
37
|
dial(ma: Multiaddr, options: DialTransportOptions<CircuitRelayDialEvents>): Promise<Connection>;
|
47
|
-
connectV2({ stream, connection, destinationPeer, destinationAddr, relayAddr, ma, disconnectOnFailure, onProgress }: ConnectOptions): Promise<Connection>;
|
48
38
|
/**
|
49
39
|
* Create a listener
|
50
40
|
*/
|
@@ -62,5 +52,4 @@ export declare class CircuitRelayTransport implements Transport<CircuitRelayDial
|
|
62
52
|
*/
|
63
53
|
onStop({ connection, stream }: IncomingStreamData): Promise<void>;
|
64
54
|
}
|
65
|
-
export {};
|
66
55
|
//# sourceMappingURL=transport.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,mBAAmB,EAAE,mBAAmB,EAAe,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAc1I,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,EAAE,+BAA+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AEG;IACG,MAAM,CAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAiFzE"}
|
@@ -9,7 +9,7 @@ import * as Digest from 'multiformats/hashes/digest';
|
|
9
9
|
import { CustomProgressEvent } from 'progress-events';
|
10
10
|
import { CIRCUIT_PROTO_CODE, DEFAULT_DISCOVERY_FILTER_ERROR_RATE, DEFAULT_DISCOVERY_FILTER_SIZE, MAX_CONNECTIONS, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from '../constants.js';
|
11
11
|
import { StopMessage, HopMessage, Status } from '../pb/index.js';
|
12
|
-
import { CircuitListen, LimitTracker } from '../utils.js';
|
12
|
+
import { CircuitListen, CircuitSearch, LimitTracker } from '../utils.js';
|
13
13
|
import { RelayDiscovery } from './discovery.js';
|
14
14
|
import { createListener } from './listener.js';
|
15
15
|
import { ReservationStore } from './reservation-store.js';
|
@@ -61,26 +61,23 @@ export class CircuitRelayTransport {
|
|
61
61
|
this.maxInboundStopStreams = init.maxInboundStopStreams ?? defaults.maxInboundStopStreams;
|
62
62
|
this.maxOutboundStopStreams = init.maxOutboundStopStreams ?? defaults.maxOutboundStopStreams;
|
63
63
|
this.stopTimeout = init.stopTimeout ?? defaults.stopTimeout;
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
.catch(err => {
|
64
|
+
this.discovery = new RelayDiscovery(components, {
|
65
|
+
filter: init.discoveryFilter ?? peerFilter(DEFAULT_DISCOVERY_FILTER_SIZE, DEFAULT_DISCOVERY_FILTER_ERROR_RATE)
|
66
|
+
});
|
67
|
+
this.discovery.addEventListener('relay:discover', (evt) => {
|
68
|
+
this.reservationStore.addRelay(evt.detail, 'discovered')
|
69
|
+
.catch(err => {
|
70
|
+
if (err.name !== 'HadEnoughRelaysError' && err.name !== 'RelayQueueFullError') {
|
72
71
|
this.log.error('could not add discovered relay %p', evt.detail, err);
|
73
|
-
}
|
72
|
+
}
|
74
73
|
});
|
75
|
-
}
|
74
|
+
});
|
76
75
|
this.reservationStore = new ReservationStore(components, init);
|
77
76
|
this.reservationStore.addEventListener('relay:not-enough-relays', () => {
|
78
77
|
this.discovery?.startDiscovery();
|
79
78
|
});
|
80
|
-
this.reservationStore.addEventListener('relay:
|
81
|
-
|
82
|
-
this.discovery?.stopDiscovery();
|
83
|
-
}
|
79
|
+
this.reservationStore.addEventListener('relay:found-enough-relays', () => {
|
80
|
+
this.discovery?.stopDiscovery();
|
84
81
|
});
|
85
82
|
this.started = false;
|
86
83
|
}
|
@@ -143,7 +140,6 @@ export class CircuitRelayTransport {
|
|
143
140
|
}
|
144
141
|
const relayPeer = peerIdFromString(relayId);
|
145
142
|
const destinationPeer = peerIdFromString(destinationId);
|
146
|
-
let disconnectOnFailure = false;
|
147
143
|
const relayConnections = this.connectionManager.getConnections(relayPeer);
|
148
144
|
let relayConnection = relayConnections[0];
|
149
145
|
if (relayConnection == null) {
|
@@ -152,7 +148,6 @@ export class CircuitRelayTransport {
|
|
152
148
|
});
|
153
149
|
options.onProgress?.(new CustomProgressEvent('circuit-relay:open-connection'));
|
154
150
|
relayConnection = await this.connectionManager.openConnection(relayPeer, options);
|
155
|
-
disconnectOnFailure = true;
|
156
151
|
}
|
157
152
|
else {
|
158
153
|
options.onProgress?.(new CustomProgressEvent('circuit-relay:reuse-connection'));
|
@@ -160,41 +155,19 @@ export class CircuitRelayTransport {
|
|
160
155
|
let stream;
|
161
156
|
try {
|
162
157
|
options.onProgress?.(new CustomProgressEvent('circuit-relay:open-hop-stream'));
|
163
|
-
stream = await relayConnection.newStream(RELAY_V2_HOP_CODEC);
|
164
|
-
return await this.connectV2({
|
165
|
-
stream,
|
166
|
-
connection: relayConnection,
|
167
|
-
destinationPeer,
|
168
|
-
destinationAddr,
|
169
|
-
relayAddr,
|
170
|
-
ma,
|
171
|
-
disconnectOnFailure,
|
172
|
-
onProgress: options.onProgress
|
173
|
-
});
|
174
|
-
}
|
175
|
-
catch (err) {
|
176
|
-
this.log.error('circuit relay dial to destination %p via relay %p failed', destinationPeer, relayPeer, err);
|
177
|
-
if (stream != null) {
|
178
|
-
stream.abort(err);
|
179
|
-
}
|
180
|
-
disconnectOnFailure && await relayConnection.close();
|
181
|
-
throw err;
|
182
|
-
}
|
183
|
-
}
|
184
|
-
async connectV2({ stream, connection, destinationPeer, destinationAddr, relayAddr, ma, disconnectOnFailure, onProgress }) {
|
185
|
-
try {
|
158
|
+
stream = await relayConnection.newStream(RELAY_V2_HOP_CODEC, options);
|
186
159
|
const pbstr = pbStream(stream);
|
187
160
|
const hopstr = pbstr.pb(HopMessage);
|
188
|
-
onProgress?.(new CustomProgressEvent('circuit-relay:write-connect-message'));
|
161
|
+
options.onProgress?.(new CustomProgressEvent('circuit-relay:write-connect-message'));
|
189
162
|
await hopstr.write({
|
190
163
|
type: HopMessage.Type.CONNECT,
|
191
164
|
peer: {
|
192
165
|
id: destinationPeer.toMultihash().bytes,
|
193
166
|
addrs: [multiaddr(destinationAddr).bytes]
|
194
167
|
}
|
195
|
-
});
|
196
|
-
onProgress?.(new CustomProgressEvent('circuit-relay:read-connect-response'));
|
197
|
-
const status = await hopstr.read();
|
168
|
+
}, options);
|
169
|
+
options.onProgress?.(new CustomProgressEvent('circuit-relay:read-connect-response'));
|
170
|
+
const status = await hopstr.read(options);
|
198
171
|
if (status.status !== Status.OK) {
|
199
172
|
throw new InvalidMessageError(`failed to connect via relay with status ${status?.status?.toString() ?? 'undefined'}`);
|
200
173
|
}
|
@@ -209,13 +182,13 @@ export class CircuitRelayTransport {
|
|
209
182
|
});
|
210
183
|
this.log('new outbound relayed connection %a', maConn.remoteAddr);
|
211
184
|
return await this.upgrader.upgradeOutbound(maConn, {
|
212
|
-
|
213
|
-
|
185
|
+
...options,
|
186
|
+
limits: limits.getLimits()
|
214
187
|
});
|
215
188
|
}
|
216
189
|
catch (err) {
|
217
|
-
this.log.error(
|
218
|
-
|
190
|
+
this.log.error('circuit relay dial to destination %p via relay %p failed', destinationPeer, relayPeer, err);
|
191
|
+
stream?.abort(err);
|
219
192
|
throw err;
|
220
193
|
}
|
221
194
|
}
|
@@ -235,7 +208,7 @@ export class CircuitRelayTransport {
|
|
235
208
|
listenFilter(multiaddrs) {
|
236
209
|
multiaddrs = Array.isArray(multiaddrs) ? multiaddrs : [multiaddrs];
|
237
210
|
return multiaddrs.filter((ma) => {
|
238
|
-
return CircuitListen.exactMatch(ma);
|
211
|
+
return CircuitListen.exactMatch(ma) || CircuitSearch.exactMatch(ma);
|
239
212
|
});
|
240
213
|
}
|
241
214
|
/**
|