@libp2p/circuit-relay-v2 2.1.5 → 3.0.0-717731e49

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 +4 -4
  2. package/dist/src/constants.d.ts +0 -1
  3. package/dist/src/constants.d.ts.map +1 -1
  4. package/dist/src/constants.js +0 -1
  5. package/dist/src/constants.js.map +1 -1
  6. package/dist/src/errors.d.ts +22 -0
  7. package/dist/src/errors.d.ts.map +1 -1
  8. package/dist/src/errors.js +22 -0
  9. package/dist/src/errors.js.map +1 -1
  10. package/dist/src/transport/discovery.d.ts +1 -0
  11. package/dist/src/transport/discovery.d.ts.map +1 -1
  12. package/dist/src/transport/discovery.js +38 -8
  13. package/dist/src/transport/discovery.js.map +1 -1
  14. package/dist/src/transport/index.d.ts +0 -6
  15. package/dist/src/transport/index.d.ts.map +1 -1
  16. package/dist/src/transport/index.js.map +1 -1
  17. package/dist/src/transport/listener.d.ts +3 -0
  18. package/dist/src/transport/listener.d.ts.map +1 -1
  19. package/dist/src/transport/listener.js +57 -27
  20. package/dist/src/transport/listener.js.map +1 -1
  21. package/dist/src/transport/reservation-store.d.ts +37 -14
  22. package/dist/src/transport/reservation-store.d.ts.map +1 -1
  23. package/dist/src/transport/reservation-store.js +125 -80
  24. package/dist/src/transport/reservation-store.js.map +1 -1
  25. package/dist/src/transport/transport.d.ts +2 -13
  26. package/dist/src/transport/transport.d.ts.map +1 -1
  27. package/dist/src/transport/transport.js +22 -49
  28. package/dist/src/transport/transport.js.map +1 -1
  29. package/dist/src/utils.d.ts +5 -2
  30. package/dist/src/utils.d.ts.map +1 -1
  31. package/dist/src/utils.js +7 -4
  32. package/dist/src/utils.js.map +1 -1
  33. package/package.json +12 -11
  34. package/src/constants.ts +0 -2
  35. package/src/errors.ts +25 -0
  36. package/src/transport/discovery.ts +47 -9
  37. package/src/transport/index.ts +0 -7
  38. package/src/transport/listener.ts +75 -35
  39. package/src/transport/reservation-store.ts +184 -102
  40. package/src/transport/transport.ts +25 -71
  41. package/src/utils.ts +12 -4
  42. package/dist/typedoc-urls.json +0 -23
package/src/utils.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { P2P } from '@multiformats/multiaddr-matcher'
2
- import { fmt, peerId, literal, optional, and } from '@multiformats/multiaddr-matcher/utils'
2
+ import { fmt, literal, and } from '@multiformats/multiaddr-matcher/utils'
3
3
  import { anySignal } from 'any-signal'
4
4
  import { CID } from 'multiformats/cid'
5
5
  import { sha256 } from 'multiformats/hashes/sha2'
@@ -194,7 +194,15 @@ export class LimitTracker {
194
194
  }
195
195
 
196
196
  /**
197
- * A custom matcher that makes the `/p2p/peer-id` part of circuit relay
198
- * addresses optional
197
+ * A custom matcher that tells us to listen on a particular relay
199
198
  */
200
- export const CircuitListen = fmt(and(P2P.matchers[0], literal('p2p-circuit'), optional(peerId())))
199
+ export const CircuitListen = fmt(
200
+ and(P2P.matchers[0], literal('p2p-circuit'))
201
+ )
202
+
203
+ /**
204
+ * A custom matcher that tells us to discover available relays
205
+ */
206
+ export const CircuitSearch = fmt(
207
+ literal('p2p-circuit')
208
+ )
@@ -1,23 +0,0 @@
1
- {
2
- "codec": "https://libp2p.github.io/js-libp2p/functions/_libp2p_circuit_relay_v2.Limit.codec.html",
3
- "decode": "https://libp2p.github.io/js-libp2p/functions/_libp2p_circuit_relay_v2.Limit.decode.html",
4
- "encode": "https://libp2p.github.io/js-libp2p/functions/_libp2p_circuit_relay_v2.Limit.encode.html",
5
- "CircuitRelayServerComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayServerComponents.html",
6
- "CircuitRelayServerInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayServerInit.html",
7
- "CircuitRelayService": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayService.html",
8
- ".:CircuitRelayService": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayService.html",
9
- "CircuitRelayServiceEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayServiceEvents.html",
10
- ".:CircuitRelayServiceEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayServiceEvents.html",
11
- "CircuitRelayTransportComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayTransportComponents.html",
12
- "CircuitRelayTransportInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayTransportInit.html",
13
- "Limit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.Limit-1.html",
14
- "RelayDiscoveryComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.RelayDiscoveryComponents.html",
15
- "RelayReservation": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.RelayReservation.html",
16
- ".:RelayReservation": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.RelayReservation.html",
17
- "ServerReservationStoreInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.ServerReservationStoreInit.html",
18
- "TransportReservationStoreInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.TransportReservationStoreInit.html",
19
- "RELAY_V2_HOP_CODEC": "https://libp2p.github.io/js-libp2p/variables/_libp2p_circuit_relay_v2.RELAY_V2_HOP_CODEC.html",
20
- "RELAY_V2_STOP_CODEC": "https://libp2p.github.io/js-libp2p/variables/_libp2p_circuit_relay_v2.RELAY_V2_STOP_CODEC.html",
21
- "circuitRelayServer": "https://libp2p.github.io/js-libp2p/functions/_libp2p_circuit_relay_v2.circuitRelayServer.html",
22
- "circuitRelayTransport": "https://libp2p.github.io/js-libp2p/functions/_libp2p_circuit_relay_v2.circuitRelayTransport.html"
23
- }