Skip to content

Commit

Permalink
deps(dev): bump @libp2p/interop from 11.0.0 to 12.1.0 (#2582)
Browse files Browse the repository at this point in the history
* deps(dev): bump @libp2p/interop from 11.0.0 to 12.1.0

Bumps [@libp2p/interop](https://github.com/libp2p/interop) from 11.0.0 to 12.1.0.
- [Release notes](https://github.com/libp2p/interop/releases)
- [Changelog](https://github.com/libp2p/interop/blob/main/CHANGELOG.md)
- [Commits](libp2p/interop@v11.0.0...v12.1.0)

---
updated-dependencies:
- dependency-name: "@libp2p/interop"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: configure addresses

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: achingbrain <alex@achingbrain.net>
  • Loading branch information
dependabot[bot] and achingbrain committed Jun 7, 2024
1 parent 62e3225 commit 90d10b5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 23 additions & 3 deletions packages/integration-tests/test/interop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -46,7 +46,15 @@ async function createGoPeer (options: SpawnOptions): Promise<Daemon> {
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) {
Expand Down Expand Up @@ -122,7 +130,7 @@ async function createJsPeer (options: SpawnOptions): Promise<Daemon> {
const opts: Libp2pOptions<ServiceMap> = {
peerId,
addresses: {
listen: options.noListen === true ? [] : ['/ip4/127.0.0.1/tcp/0']
listen: []
},
transports: [tcp(), circuitRelayTransport()],
streamMuxers: [],
Expand All @@ -132,6 +140,18 @@ async function createJsPeer (options: SpawnOptions): Promise<Daemon> {
}
}

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()
}
Expand Down

0 comments on commit 90d10b5

Please sign in to comment.