@peerbit/libp2p-test-utils 2.2.0 → 3.0.0-b712c6b

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/src/session.ts CHANGED
@@ -108,7 +108,8 @@ export class TestSession<T> {
108
108
 
109
109
  const node = await createLibp2p<T & DefaultServices>({
110
110
  addresses: {
111
- listen: listen(),
111
+ ...(definedOptions?.addresses ?? {}),
112
+ listen: definedOptions?.addresses?.listen ?? listen(),
112
113
  },
113
114
  connectionManager: definedOptions?.connectionManager,
114
115
  privateKey: definedOptions?.privateKey,
package/src/transports.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  circuitRelayTransport,
4
4
  } from "@libp2p/circuit-relay-v2";
5
5
  import type { Transport } from "@libp2p/interface";
6
+ import { tcp } from "@libp2p/tcp";
6
7
  import { webRTC } from "@libp2p/webrtc";
7
8
  import { webSockets } from "@libp2p/websockets";
8
9
 
@@ -14,6 +15,10 @@ export const transports = (): Array<(components: any) => Transport> => [
14
15
  webSockets(),
15
16
  ];
16
17
 
18
+ export const transportsFast = (): Array<(components: any) => Transport> => [
19
+ tcp(),
20
+ ];
21
+
17
22
  // applyDefaultLimit: false because of https://github.com/libp2p/js-libp2p/issues/2622
18
23
  export const relay = (): ReturnType<typeof circuitRelayServer> =>
19
24
  circuitRelayServer({ reservations: { applyDefaultLimit: false } });
@@ -23,3 +28,5 @@ export const listen = (): string[] => [
23
28
  "/ip4/127.0.0.1/tcp/0/ws",
24
29
  "/p2p-circuit",
25
30
  ];
31
+
32
+ export const listenFast = (): string[] => ["/ip4/127.0.0.1/tcp/0"];