diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index 718d7ac0fe..4043fac55e 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -49,7 +49,7 @@ "@libp2p/interface": "^1.3.1", "@libp2p/interface-compliance-tests": "^5.4.4", "@libp2p/interface-internal": "^1.2.1", - "@libp2p/interop": "^11.0.0", + "@libp2p/interop": "^12.1.0", "@libp2p/kad-dht": "^12.0.16", "@libp2p/logger": "^4.0.12", "@libp2p/mdns": "^10.0.23", diff --git a/packages/integration-tests/test/interop.ts b/packages/integration-tests/test/interop.ts index 66693528fc..01f0a4a4c9 100644 --- a/packages/integration-tests/test/interop.ts +++ b/packages/integration-tests/test/interop.ts @@ -8,7 +8,7 @@ import { createClient } from '@libp2p/daemon-client' import { createServer } from '@libp2p/daemon-server' import { floodsub } from '@libp2p/floodsub' import { identify } from '@libp2p/identify' -import { interopTests } from '@libp2p/interop' +import { UnsupportedError, interopTests } from '@libp2p/interop' import { kadDHT, passthroughMapper } from '@libp2p/kad-dht' import { logger } from '@libp2p/logger' import { mplex } from '@libp2p/mplex' @@ -46,7 +46,15 @@ async function createGoPeer (options: SpawnOptions): Promise { if (options.noListen === true) { opts.push('-noListenAddrs') } else { - opts.push('-hostAddrs=/ip4/127.0.0.1/tcp/0') + if (options.transport == null || options.transport === 'tcp') { + opts.push('-hostAddrs=/ip4/127.0.0.1/tcp/0') + } else if (options.transport === 'webtransport') { + opts.push('-hostAddrs=/ip4/127.0.0.1/udp/0/quic-v1/webtransport') + } else if (options.transport === 'webrtc-direct') { + opts.push('-hostAddrs=/ip4/127.0.0.1/udp/0/webrtc-direct') + } else { + throw new UnsupportedError() + } } if (options.encryption != null) { @@ -122,7 +130,7 @@ async function createJsPeer (options: SpawnOptions): Promise { const opts: Libp2pOptions = { peerId, addresses: { - listen: options.noListen === true ? [] : ['/ip4/127.0.0.1/tcp/0'] + listen: [] }, transports: [tcp(), circuitRelayTransport()], streamMuxers: [], @@ -132,6 +140,18 @@ async function createJsPeer (options: SpawnOptions): Promise { } } + if (options.noListen !== true) { + if (options.transport == null || options.transport === 'tcp') { + opts.addresses?.listen?.push('/ip4/127.0.0.1/tcp/0') + } else { + throw new UnsupportedError() + } + } + + if (options.transport === 'webtransport' || options.transport === 'webrtc-direct') { + throw new UnsupportedError() + } + const services: ServiceFactoryMap = { identify: identify() }