@libp2p/circuit-relay-v2 1.0.24-62e32252a → 1.0.24-757fb2674

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/dist/index.min.js +3 -3
  2. package/dist/src/constants.d.ts +12 -13
  3. package/dist/src/constants.d.ts.map +1 -1
  4. package/dist/src/constants.js +12 -13
  5. package/dist/src/constants.js.map +1 -1
  6. package/dist/src/pb/index.d.ts +7 -7
  7. package/dist/src/pb/index.d.ts.map +1 -1
  8. package/dist/src/pb/index.js +52 -94
  9. package/dist/src/pb/index.js.map +1 -1
  10. package/dist/src/server/advert-service.d.ts +44 -0
  11. package/dist/src/server/advert-service.d.ts.map +1 -0
  12. package/dist/src/server/advert-service.js +72 -0
  13. package/dist/src/server/advert-service.js.map +1 -0
  14. package/dist/src/server/index.d.ts +7 -1
  15. package/dist/src/server/index.d.ts.map +1 -1
  16. package/dist/src/server/index.js +19 -10
  17. package/dist/src/server/index.js.map +1 -1
  18. package/dist/src/transport/discovery.d.ts +10 -15
  19. package/dist/src/transport/discovery.d.ts.map +1 -1
  20. package/dist/src/transport/discovery.js +51 -103
  21. package/dist/src/transport/discovery.js.map +1 -1
  22. package/dist/src/transport/index.d.ts +18 -27
  23. package/dist/src/transport/index.d.ts.map +1 -1
  24. package/dist/src/transport/index.js +3 -0
  25. package/dist/src/transport/index.js.map +1 -1
  26. package/dist/src/transport/reservation-store.d.ts +3 -7
  27. package/dist/src/transport/reservation-store.d.ts.map +1 -1
  28. package/dist/src/transport/reservation-store.js +13 -37
  29. package/dist/src/transport/reservation-store.js.map +1 -1
  30. package/dist/src/transport/transport.d.ts +1 -0
  31. package/dist/src/transport/transport.d.ts.map +1 -1
  32. package/dist/src/transport/transport.js +19 -20
  33. package/dist/src/transport/transport.js.map +1 -1
  34. package/package.json +12 -11
  35. package/src/constants.ts +15 -16
  36. package/src/pb/index.ts +53 -96
  37. package/src/server/advert-service.ts +107 -0
  38. package/src/server/index.ts +29 -11
  39. package/src/transport/discovery.ts +56 -121
  40. package/src/transport/index.ts +18 -28
  41. package/src/transport/reservation-store.ts +13 -45
  42. package/src/transport/transport.ts +21 -21
@@ -0,0 +1,72 @@
1
+ import { TypedEventEmitter } from '@libp2p/interface';
2
+ import pRetry from 'p-retry';
3
+ import { DEFAULT_ADVERT_BOOT_DELAY, ERR_NO_ROUTERS_AVAILABLE, RELAY_RENDEZVOUS_NS } from '../constants.js';
4
+ import { namespaceToCid } from '../utils.js';
5
+ export class AdvertService extends TypedEventEmitter {
6
+ contentRouting;
7
+ timeout;
8
+ started;
9
+ bootDelay;
10
+ log;
11
+ /**
12
+ * Creates an instance of Relay
13
+ */
14
+ constructor(components, init) {
15
+ super();
16
+ this.log = components.logger.forComponent('libp2p:circuit-relay:advert-service');
17
+ this.contentRouting = components.contentRouting;
18
+ this.bootDelay = init?.bootDelay ?? DEFAULT_ADVERT_BOOT_DELAY;
19
+ this.started = false;
20
+ }
21
+ isStarted() {
22
+ return this.started;
23
+ }
24
+ /**
25
+ * Start Relay service
26
+ */
27
+ start() {
28
+ if (this.started) {
29
+ return;
30
+ }
31
+ // Advertise service if HOP enabled and advertising enabled
32
+ this.timeout = setTimeout(() => {
33
+ this._advertiseService().catch(err => {
34
+ this.log.error('could not advertise service', err);
35
+ });
36
+ }, this.bootDelay);
37
+ this.started = true;
38
+ }
39
+ /**
40
+ * Stop Relay service
41
+ */
42
+ stop() {
43
+ try {
44
+ clearTimeout(this.timeout);
45
+ }
46
+ catch (err) { }
47
+ this.started = false;
48
+ }
49
+ /**
50
+ * Advertise hop relay service in the network.
51
+ */
52
+ async _advertiseService() {
53
+ await pRetry(async () => {
54
+ try {
55
+ const cid = await namespaceToCid(RELAY_RENDEZVOUS_NS);
56
+ await this.contentRouting.provide(cid);
57
+ this.safeDispatchEvent('advert:success', { detail: undefined });
58
+ }
59
+ catch (err) {
60
+ this.safeDispatchEvent('advert:error', { detail: err });
61
+ if (err.code === ERR_NO_ROUTERS_AVAILABLE) {
62
+ this.log.error('a content router, such as a DHT, must be provided in order to advertise the relay service', err);
63
+ this.stop();
64
+ return;
65
+ }
66
+ this.log.error('could not advertise service', err);
67
+ throw err;
68
+ }
69
+ });
70
+ }
71
+ }
72
+ //# sourceMappingURL=advert-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advert-service.js","sourceRoot":"","sources":["../../../src/server/advert-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAuB5C,MAAM,OAAO,aAAc,SAAQ,iBAAsC;IACtD,cAAc,CAAgB;IACvC,OAAO,CAAM;IACb,OAAO,CAAS;IACP,SAAS,CAAQ;IACjB,GAAG,CAAQ;IAE5B;;OAEG;IACH,YAAa,UAAmC,EAAE,IAAwB;QACxE,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,qCAAqC,CAAC,CAAA;QAChF,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAA;QAC/C,IAAI,CAAC,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,yBAAyB,CAAA;QAC7D,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAM;QACR,CAAC;QAED,2DAA2D;QAC3D,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC7B,IAAI,CAAC,iBAAiB,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;gBACnC,IAAI,CAAC,GAAG,CAAC,KAAK,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, StopMessage } from '../pb/index.js';
3
+ import { type AdvertServiceComponents, type AdvertServiceInit } from './advert-service.js';
3
4
  import { type ReservationStoreInit } from './reservation-store.js';
4
5
  import type { CircuitRelayService, RelayReservation } from '../index.js';
5
6
  import type { ComponentLogger, Connection, Stream, ConnectionGater, PeerId, PeerStore } from '@libp2p/interface';
@@ -10,6 +11,11 @@ export interface CircuitRelayServerInit {
10
11
  * the stream will be reset (default: 30s)
11
12
  */
12
13
  hopTimeout?: number;
14
+ /**
15
+ * If true, advertise this service via libp2p content routing to allow
16
+ * peers to locate us on the network (default: false)
17
+ */
18
+ advertise?: boolean | AdvertServiceInit;
13
19
  /**
14
20
  * Configuration of reservations
15
21
  */
@@ -37,7 +43,7 @@ export interface StopOptions {
37
43
  connection: Connection;
38
44
  request: StopMessage;
39
45
  }
40
- export interface CircuitRelayServerComponents {
46
+ export interface CircuitRelayServerComponents extends AdvertServiceComponents {
41
47
  registrar: Registrar;
42
48
  peerStore: PeerStore;
43
49
  addressManager: AddressManager;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAUlE,OAAO,EAAE,UAAU,EAA4B,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAElF,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAEpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAU,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AACnI,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAsB,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAKlH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,UAAU,CAAC,EAAE,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,WAAW,iBAAiB;IAChC,mBAAmB,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;IAClD,sBAAsB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC5C,oBAAoB,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;CACzC;AA4VD,wBAAgB,kBAAkB,CAAE,IAAI,GAAE,sBAA2B,GAAG,CAAC,UAAU,EAAE,4BAA4B,KAAK,mBAAmB,CAIxI"}
@@ -7,6 +7,7 @@ import pDefer from 'p-defer';
7
7
  import { CIRCUIT_PROTO_CODE, DEFAULT_HOP_TIMEOUT, MAX_CONNECTIONS, RELAY_SOURCE_TAG, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from '../constants.js';
8
8
  import { HopMessage, Status, StopMessage } from '../pb/index.js';
9
9
  import { createLimitedRelay } from '../utils.js';
10
+ import { AdvertService } from './advert-service.js';
10
11
  import { ReservationStore } from './reservation-store.js';
11
12
  import { ReservationVoucherRecord } from './reservation-voucher.js';
12
13
  const isRelayAddr = (ma) => ma.protoCodes().includes(CIRCUIT_PROTO_CODE);
@@ -21,6 +22,7 @@ class CircuitRelayServer extends TypedEventEmitter {
21
22
  connectionManager;
22
23
  connectionGater;
23
24
  reservationStore;
25
+ advertService;
24
26
  started;
25
27
  hopTimeout;
26
28
  shutdownController;
@@ -42,12 +44,21 @@ class CircuitRelayServer extends TypedEventEmitter {
42
44
  this.connectionGater = components.connectionGater;
43
45
  this.started = false;
44
46
  this.hopTimeout = init?.hopTimeout ?? DEFAULT_HOP_TIMEOUT;
47
+ this.shutdownController = new AbortController();
45
48
  this.maxInboundHopStreams = init.maxInboundHopStreams;
46
49
  this.maxOutboundHopStreams = init.maxOutboundHopStreams;
47
50
  this.maxOutboundStopStreams = init.maxOutboundStopStreams ?? defaults.maxOutboundStopStreams;
48
- this.reservationStore = new ReservationStore(init.reservations);
49
- this.shutdownController = new AbortController();
50
51
  setMaxListeners(Infinity, this.shutdownController.signal);
52
+ if (init.advertise != null && init.advertise !== false) {
53
+ this.advertService = new AdvertService(components, init.advertise === true ? undefined : init.advertise);
54
+ this.advertService.addEventListener('advert:success', () => {
55
+ this.safeDispatchEvent('relay:advert:success', {});
56
+ });
57
+ this.advertService.addEventListener('advert:error', (evt) => {
58
+ this.safeDispatchEvent('relay:advert:error', { detail: evt.detail });
59
+ });
60
+ }
61
+ this.reservationStore = new ReservationStore(init.reservations);
51
62
  }
52
63
  isStarted() {
53
64
  return this.started;
@@ -59,6 +70,8 @@ class CircuitRelayServer extends TypedEventEmitter {
59
70
  if (this.started) {
60
71
  return;
61
72
  }
73
+ // Advertise service if HOP enabled and advertising enabled
74
+ this.advertService?.start();
62
75
  await this.registrar.handle(RELAY_V2_HOP_CODEC, (data) => {
63
76
  void this.onHop(data).catch(err => {
64
77
  this.log.error(err);
@@ -75,6 +88,7 @@ class CircuitRelayServer extends TypedEventEmitter {
75
88
  * Stop Relay service
76
89
  */
77
90
  async stop() {
91
+ this.advertService?.stop();
78
92
  this.reservationStore.stop();
79
93
  this.shutdownController.abort();
80
94
  await this.registrar.unhandle(RELAY_V2_HOP_CODEC);
@@ -231,7 +245,6 @@ class CircuitRelayServer extends TypedEventEmitter {
231
245
  await hopstr.write({ type: HopMessage.Type.STATUS, status: Status.NO_RESERVATION });
232
246
  return;
233
247
  }
234
- const limit = this.reservationStore.get(dstPeer)?.limit;
235
248
  const destinationConnection = connections[0];
236
249
  const destinationStream = await this.stopHop({
237
250
  connection: destinationConnection,
@@ -240,8 +253,7 @@ class CircuitRelayServer extends TypedEventEmitter {
240
253
  peer: {
241
254
  id: connection.remotePeer.toBytes(),
242
255
  addrs: []
243
- },
244
- limit
256
+ }
245
257
  }
246
258
  });
247
259
  if (destinationStream == null) {
@@ -249,13 +261,10 @@ class CircuitRelayServer extends TypedEventEmitter {
249
261
  await hopstr.write({ type: HopMessage.Type.STATUS, status: Status.CONNECTION_FAILED });
250
262
  return;
251
263
  }
252
- await hopstr.write({
253
- type: HopMessage.Type.STATUS,
254
- status: Status.OK,
255
- limit
256
- });
264
+ await hopstr.write({ type: HopMessage.Type.STATUS, status: Status.OK });
257
265
  const sourceStream = stream.unwrap();
258
266
  this.log('connection from %p to %p established - merging streams', connection.remotePeer, dstPeer);
267
+ const limit = this.reservationStore.get(dstPeer)?.limit;
259
268
  // Short circuit the two streams to create the relayed connection
260
269
  createLimitedRelay(sourceStream, destinationStream, this.shutdownController.signal, limit, {
261
270
  log: this.log
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAkB,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAuB,MAAM,oBAAoB,CAAA;AAClE,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,UAAU,EAAoB,MAAM,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAA6B,MAAM,wBAAwB,CAAA;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAA;AAMnE,MAAM,WAAW,GAAG,CAAC,EAAa,EAAW,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAA;AA0D5F,MAAM,QAAQ,GAAG;IACf,sBAAsB,EAAE,eAAe;CACxC,CAAA;AAED,MAAM,kBAAmB,SAAQ,i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AU,CAAC,UAAU,CAAC,CAAA;QACtF,CAAC;QAED,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iCAAiC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;YACxE,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;YACpB,OAAM;QACR,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,CAAC,GAAG,CAAC,mCAAmC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;YACpE,OAAO,KAAK,CAAC,MAAM,EAAE,CAAA;QACvB,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,kCAAkC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;QAC7D,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAA;IAC3C,CAAC;CACF;AAED,MAAM,UAAU,kBAAkB,CAAE,OAA+B,EAAE;IACnE,OAAO,CAAC,UAAU,EAAE,EAAE;QACpB,OAAO,IAAI,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IACjD,CAAC,CAAA;AACH,CAAC"}
@@ -1,48 +1,43 @@
1
1
  import { TypedEventEmitter } from '@libp2p/interface';
2
- import type { ComponentLogger, PeerId, PeerStore, Startable, TopologyFilter } from '@libp2p/interface';
3
- import type { ConnectionManager, RandomWalk, Registrar, TransportManager } from '@libp2p/interface-internal';
2
+ import type { ComponentLogger, ContentRouting, PeerId, PeerStore, Startable } from '@libp2p/interface';
3
+ import type { ConnectionManager, Registrar, TransportManager } from '@libp2p/interface-internal';
4
4
  export interface RelayDiscoveryEvents {
5
5
  'relay:discover': CustomEvent<PeerId>;
6
6
  }
7
7
  export interface RelayDiscoveryComponents {
8
+ peerId: PeerId;
8
9
  peerStore: PeerStore;
9
10
  connectionManager: ConnectionManager;
10
11
  transportManager: TransportManager;
12
+ contentRouting: ContentRouting;
11
13
  registrar: Registrar;
12
14
  logger: ComponentLogger;
13
- randomWalk: RandomWalk;
14
- }
15
- export interface RelayDiscoveryInit {
16
- filter?: TopologyFilter;
17
15
  }
18
16
  /**
19
17
  * ReservationManager automatically makes a circuit v2 reservation on any connected
20
18
  * peers that support the circuit v2 HOP protocol.
21
19
  */
22
20
  export declare class RelayDiscovery extends TypedEventEmitter<RelayDiscoveryEvents> implements Startable {
21
+ private readonly peerId;
23
22
  private readonly peerStore;
23
+ private readonly contentRouting;
24
24
  private readonly registrar;
25
- private readonly connectionManager;
26
- private readonly randomWalk;
27
25
  private started;
28
- private running;
29
26
  private topologyId?;
30
27
  private readonly log;
31
- private discoveryController;
32
- private readonly filter?;
33
- constructor(components: RelayDiscoveryComponents, init?: RelayDiscoveryInit);
28
+ constructor(components: RelayDiscoveryComponents);
34
29
  isStarted(): boolean;
35
30
  start(): Promise<void>;
31
+ afterStart(): void;
36
32
  stop(): void;
37
33
  /**
38
34
  * Try to listen on available hop relay connections.
39
35
  * The following order will happen while we do not have enough relays:
40
36
  *
41
- * 1. Check the metadata store for known relays, try to listen on the ones we are already connected to
37
+ * 1. Check the metadata store for known relays, try to listen on the ones we are already connected
42
38
  * 2. Dial and try to listen on the peers we know that support hop but are not connected
43
39
  * 3. Search the network
44
40
  */
45
- startDiscovery(): void;
46
- stopDiscovery(): void;
41
+ discover(): Promise<void>;
47
42
  }
48
43
  //# sourceMappingURL=discovery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/transport/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAmB,MAAM,mBAAmB,CAAA;AAOtE,OAAO,KAAK,EAAE,eAAe,EAAU,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC9G,OAAO,KAAK,EAAE,iB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
- import { PeerQueue } from '@libp2p/utils/peer-queue';
3
- import { anySignal } from 'any-signal';
4
- import { raceSignal } from 'race-signal';
5
- import { RELAY_V2_HOP_CODEC } from '../constants.js';
1
+ import { TypedEventEmitter } from '@libp2p/interface';
2
+ import { RELAY_RENDEZVOUS_NS, RELAY_V2_HOP_CODEC } from '../constants.js';
3
+ import { namespaceToCid } from '../utils.js';
6
4
  /**
7
5
  * ReservationManager automatically makes a circuit v2 reservation on any connected
8
6
  * peers that support the circuit v2 HOP protocol.
9
7
  */
10
8
  export class RelayDiscovery extends TypedEventEmitter {
9
+ peerId;
11
10
  peerStore;
11
+ contentRouting;
12
12
  registrar;
13
- connectionManager;
14
- randomWalk;
15
13
  started;
16
- running;
17
14
  topologyId;
18
15
  log;
19
- discoveryController;
20
- filter;
21
- constructor(components, init = {}) {
16
+ constructor(components) {
22
17
  super();
23
18
  this.log = components.logger.forComponent('libp2p:circuit-relay:discover-relays');
24
19
  this.started = false;
25
- this.running = false;
20
+ this.peerId = components.peerId;
26
21
  this.peerStore = components.peerStore;
22
+ this.contentRouting = components.contentRouting;
27
23
  this.registrar = components.registrar;
28
- this.connectionManager = components.connectionManager;
29
- this.randomWalk = components.randomWalk;
30
- this.filter = init.filter;
31
- this.discoveryController = new AbortController();
32
- setMaxListeners(Infinity, this.discoveryController.signal);
33
24
  }
34
25
  isStarted() {
35
26
  return this.started;
@@ -38,114 +29,71 @@ export class RelayDiscovery extends TypedEventEmitter {
38
29
  // register a topology listener for when new peers are encountered
39
30
  // that support the hop protocol
40
31
  this.topologyId = await this.registrar.register(RELAY_V2_HOP_CODEC, {
41
- filter: this.filter,
32
+ notifyOnTransient: true,
42
33
  onConnect: (peerId) => {
43
- this.log('discovered relay %p', peerId);
44
34
  this.safeDispatchEvent('relay:discover', { detail: peerId });
45
35
  }
46
36
  });
47
37
  this.started = true;
48
38
  }
39
+ afterStart() {
40
+ void this.discover()
41
+ .catch(err => {
42
+ this.log.error('error discovering relays', err);
43
+ });
44
+ }
49
45
  stop() {
50
46
  if (this.topologyId != null) {
51
47
  this.registrar.unregister(this.topologyId);
52
48
  }
53
- this.discoveryController?.abort();
54
49
  this.started = false;
55
50
  }
56
51
  /**
57
52
  * Try to listen on available hop relay connections.
58
53
  * The following order will happen while we do not have enough relays:
59
54
  *
60
- * 1. Check the metadata store for known relays, try to listen on the ones we are already connected to
55
+ * 1. Check the metadata store for known relays, try to listen on the ones we are already connected
61
56
  * 2. Dial and try to listen on the peers we know that support hop but are not connected
62
57
  * 3. Search the network
63
58
  */
64
- startDiscovery() {
65
- if (this.running) {
66
- return;
67
- }
68
- this.log('start discovery');
69
- this.running = true;
70
- this.discoveryController = new AbortController();
71
- setMaxListeners(Infinity, this.discoveryController.signal);
72
- Promise.resolve()
73
- .then(async () => {
74
- this.log('searching peer store for relays');
75
- const peers = (await this.peerStore.all({
76
- filters: [
77
- // filter by a list of peers supporting RELAY_V2_HOP and ones we are not listening on
78
- (peer) => {
79
- return peer.protocols.includes(RELAY_V2_HOP_CODEC);
80
- }
81
- ],
82
- orders: [
83
- () => Math.random() < 0.5 ? 1 : -1
84
- ]
85
- }));
86
- for (const peer of peers) {
87
- this.log.trace('found relay peer %p in peer store', peer.id);
88
- this.safeDispatchEvent('relay:discover', { detail: peer.id });
89
- }
90
- this.log('found %d relay peers in peer store', peers.length);
91
- // perform random walk and dial peers - after identify has run, the network
92
- // topology will be notified of new relays
93
- const queue = new PeerQueue({
94
- concurrency: 5
95
- });
96
- this.log('start random walk');
97
- for await (const peer of this.randomWalk.walk({ signal: this.discoveryController.signal })) {
98
- this.log.trace('found random peer %p', peer.id);
99
- if (queue.has(peer.id)) {
100
- this.log.trace('random peer %p was already in queue', peer.id);
101
- // skip peers already in the queue
102
- continue;
103
- }
104
- if (this.connectionManager.getConnections(peer.id)?.length > 0) {
105
- this.log.trace('random peer %p was already connected', peer.id);
106
- // skip peers we are already connected to
107
- continue;
59
+ async discover() {
60
+ this.log('searching peer store for relays');
61
+ const peers = (await this.peerStore.all({
62
+ filters: [
63
+ // filter by a list of peers supporting RELAY_V2_HOP and ones we are not listening on
64
+ (peer) => {
65
+ return peer.protocols.includes(RELAY_V2_HOP_CODEC);
108
66
  }
109
- if (!(await this.connectionManager.isDialable(peer.multiaddrs))) {
110
- this.log.trace('random peer %p was not dialable', peer.id, peer.multiaddrs.map(ma => ma.toString()));
111
- // skip peers we can't dial
112
- continue;
67
+ ],
68
+ orders: [
69
+ () => Math.random() < 0.5 ? 1 : -1
70
+ ]
71
+ }));
72
+ for (const peer of peers) {
73
+ this.log('found relay peer %p in content peer store', peer.id);
74
+ this.safeDispatchEvent('relay:discover', { detail: peer.id });
75
+ }
76
+ this.log('found %d relay peers in peer store', peers.length);
77
+ try {
78
+ this.log('searching content routing for relays');
79
+ const cid = await namespaceToCid(RELAY_RENDEZVOUS_NS);
80
+ let found = 0;
81
+ for await (const provider of this.contentRouting.findProviders(cid)) {
82
+ if (provider.multiaddrs.length > 0 && !provider.id.equals(this.peerId)) {
83
+ const peerId = provider.id;
84
+ found++;
85
+ await this.peerStore.merge(peerId, {
86
+ multiaddrs: provider.multiaddrs
87
+ });
88
+ this.log('found relay peer %p in content routing', peerId);
89
+ this.safeDispatchEvent('relay:discover', { detail: peerId });
113
90
  }
114
- this.log.trace('wait for space in queue for %p', peer.id);
115
- // pause the random walk until there is space in the queue
116
- await raceSignal(queue.onSizeLessThan(10), this.discoveryController.signal);
117
- this.log('adding random peer %p to dial queue (length: %d)', peer.id, queue.size);
118
- // dial the peer - this will cause identify to run and our topology to
119
- // be notified and we'll attempt to create reservations
120
- queue.add(async () => {
121
- const signal = anySignal([this.discoveryController.signal, AbortSignal.timeout(5000)]);
122
- setMaxListeners(Infinity, signal);
123
- try {
124
- await this.connectionManager.openConnection(peer.id, { signal });
125
- }
126
- finally {
127
- signal.clear();
128
- }
129
- }, {
130
- peerId: peer.id,
131
- signal: this.discoveryController.signal
132
- })
133
- .catch(err => {
134
- this.log.error('error opening connection to random peer %p', peer.id, err);
135
- });
136
91
  }
137
- await queue.onIdle();
138
- })
139
- .catch(err => {
140
- if (!this.discoveryController.signal.aborted) {
141
- this.log.error('failed when finding relays on the network', err);
142
- }
143
- });
144
- }
145
- stopDiscovery() {
146
- this.log('stop discovery');
147
- this.running = false;
148
- this.discoveryController?.abort();
92
+ this.log('found %d relay peers in content routing', found);
93
+ }
94
+ catch (err) {
95
+ this.log.error('failed when finding relays on the network', err);
96
+ }
149
97
  }
150
98
  }
151
99
  //# sourceMappingURL=discovery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../../src/transport/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EACL,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AAqBxB;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAuC;IACxD,SAAS,CAAW;IACpB,SAAS,CAAW;IACpB,iBAAiB,CAAmB;IACpC,UAAU,CAAY;IAC/B,OAAO,CAAS;IAChB,OAAO,CAAS;IAChB,UAAU,CAAS;IACV,GAAG,CAAQ;IACpB,mBAAmB,CAAiB;IAC3B,MAAM,CAAiB;IAExC,YAAa,UAAoC,EAAE,OAA2B,EAAE;QAC9E,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,sCAAsC,CAAC,CAAA;QACjF,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;QACrC,IAAI,CAAC,SAAS,GAAG,UAAU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CAAC,oCAAoC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;QAE5D,IAAI,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;YAChD,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,mBAAmB,CAAC,CAAA;YAErD,IAAI,KAAK,GAAG,CAAC,CAAA;YAEb,IAAI,KAAK,EAAE,MAAM,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpE,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACvE,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAA;oBAE1B,KAAK,EAAE,CAAA;oBACP,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE;wBACjC,UAAU,EAAE,QAAQ,CAAC,UAAU;qBAChC,CAAC,CAAA;oBAEF,IAAI,CAAC,GAAG,CAAC,wCAAwC,EAAE,MAAM,CAAC,CAAA;oBAC1D,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;gBAC9D,CAAC;YACH,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAA;QAC5D,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,2CAA2C,EAAE,GAAG,CAAC,CAAA;QAClE,CAAC;IACH,CAAC;CACF"}
@@ -1,57 +1,48 @@
1
- import type { RelayDiscoveryComponents } from './discovery.js';
2
- import type { RelayStoreInit } from './reservation-store.js';
3
- import type { Transport, Upgrader, Libp2pEvents, ConnectionGater, TypedEventTarget, PeerId, TopologyFilter } from '@libp2p/interface';
4
- import type { AddressManager, Registrar } from '@libp2p/interface-internal';
1
+ import { type Transport, type Upgrader, type Libp2pEvents, type ComponentLogger, type ConnectionGater, type ContentRouting, type TypedEventTarget, type PeerId, type PeerStore } from '@libp2p/interface';
2
+ import { type RelayDiscoveryComponents } from './discovery.js';
3
+ import { type RelayStoreInit } from './reservation-store.js';
4
+ import type { AddressManager, ConnectionManager, Registrar } from '@libp2p/interface-internal';
5
5
  export interface CircuitRelayTransportComponents extends RelayDiscoveryComponents {
6
6
  peerId: PeerId;
7
+ peerStore: PeerStore;
7
8
  registrar: Registrar;
9
+ connectionManager: ConnectionManager;
8
10
  upgrader: Upgrader;
9
11
  addressManager: AddressManager;
12
+ contentRouting: ContentRouting;
10
13
  connectionGater: ConnectionGater;
11
14
  events: TypedEventTarget<Libp2pEvents>;
15
+ logger: ComponentLogger;
12
16
  }
13
17
  /**
14
18
  * RelayConfig configures the circuit v2 relay transport.
15
19
  */
16
20
  export interface CircuitRelayTransportInit extends RelayStoreInit {
17
21
  /**
18
- * The number of peers running diable relays to search for and connect to
19
- *
20
- * @default 0
22
+ * The number of peers running diable relays to search for and
23
+ * connect to. (default: 0)
21
24
  */
22
25
  discoverRelays?: number;
23
- /**
24
- * An optional filter used to prevent duplicate attempts to reserve relay
25
- * slots on the same peer
26
- */
27
- discoveryFilter?: TopologyFilter;
28
26
  /**
29
27
  * The maximum number of simultaneous STOP inbound streams that can be open at
30
- * once - each inbound relayed connection uses a STOP stream
31
- *
32
- * @default 300
28
+ * once - each inbound relayed connection uses a STOP stream (default: 300)
33
29
  */
34
30
  maxInboundStopStreams?: number;
35
31
  /**
36
- * The maximum number of simultaneous STOP outbound streams that can be open
37
- * at once. If this transport is used along with the relay server these
38
- * settings should be set to the same value
39
- *
40
- * @default 300
32
+ * The maximum number of simultaneous STOP outbound streams that can be open at
33
+ * once. If this transport is used along with the relay server these settings
34
+ * should be set to the same value (default: 300)
41
35
  */
42
36
  maxOutboundStopStreams?: number;
43
37
  /**
44
- * Incoming STOP requests (e.g. when a remote peer wants to dial us via a
45
- * relay) must finish the initial protocol negotiation within this timeout in
46
- * ms
47
- *
48
- * @default 30000
38
+ * Incoming STOP requests (e.g. when a remote peer wants to dial us via a relay)
39
+ * must finish the initial protocol negotiation within this timeout in ms
40
+ * (default: 30000)
49
41
  */
50
42
  stopTimeout?: number;
51
43
  /**
52
44
  * When creating a reservation it must complete within this number of ms
53
- *
54
- * @default 10000
45
+ * (default: 10000)
55
46
  */
56
47
  reservationCompletionTimeout?: number;
57
48
  }