Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"@chainsafe/libp2p-yamux": "^5.0.0",
"@libp2p/mplex": "^9.0.0",
"@libp2p/tcp": "^8.0.0",
"@libp2p/webrtc": "^3.0.0",
"@libp2p/websockets": "^7.0.0",
"@libp2p/webtransport": "^3.0.0",
"@multiformats/mafmt": "^12.1.2",
Expand Down
74 changes: 37 additions & 37 deletions interop/test/ping.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { mplex } from '@libp2p/mplex'
import { tcp } from '@libp2p/tcp'
import { webRTC, webRTCDirect } from '@libp2p/webrtc'
import { webSockets } from '@libp2p/websockets'
import * as filters from '@libp2p/websockets/filters'
import { webTransport } from '@libp2p/webtransport'
import { type Multiaddr, multiaddr } from '@multiformats/multiaddr'
import { createLibp2p, type Libp2p, type Libp2pOptions } from 'libp2p'
import { circuitRelayTransport } from 'libp2p/circuit-relay'
import { type IdentifyService, identifyService } from 'libp2p/identify'
import { pingService, type PingService } from 'libp2p/ping'

Expand Down Expand Up @@ -67,32 +64,34 @@ describe('ping test', function () {
throw new Error('WebTransport is not supported as a listener')
}
break
case 'webrtc-direct':
options.transports = [webRTCDirect()]
options.addresses = {
listen: isDialer ? [] : [`/ip4/${IP}/udp/0/webrtc-direct`]
}
break
case 'webrtc':
options.transports = [webRTC(),
webSockets({ filter: filters.all }), // ws needed to connect to relay
circuitRelayTransport({
discoverRelays: 1
}) // needed to use the relay
]
options.addresses = {
listen: isDialer ? [] : ['/webrtc']
}
options.connectionGater = {
denyDialMultiaddr: () => {
// by default we refuse to dial local addresses from the browser since they
// are usually sent by remote peers broadcasting undialable multiaddrs but
// here we are explicitly connecting to a local node so do not deny dialing
// any discovered address
return false
}
}
break
//
// #TODO: We can re-introduce this once https://github.com/libp2p/js-libp2p/issues/1846 is resolved
// case 'webrtc-direct':
// options.transports = [webRTCDirect()]
// options.addresses = {
// listen: isDialer ? [] : [`/ip4/${IP}/udp/0/webrtc-direct`]
// }
// break
// case 'webrtc':
// options.transports = [webRTC(),
// webSockets({ filter: filters.all }), // ws needed to connect to relay
// circuitRelayTransport({
// discoverRelays: 1
// }) // needed to use the relay
// ]
// options.addresses = {
// listen: isDialer ? [] : ['/webrtc']
// }
// options.connectionGater = {
// denyDialMultiaddr: () => {
// // by default we refuse to dial local addresses from the browser since they
// // are usually sent by remote peers broadcasting undialable multiaddrs but
// // here we are explicitly connecting to a local node so do not deny dialing
// // any discovered address
// return false
// }
// }
// break
case 'ws':
options.transports = [webSockets()]
options.addresses = {
Expand All @@ -114,17 +113,18 @@ describe('ping test', function () {
let skipMuxer = false
switch (TRANSPORT) {
case 'webtransport':
case 'webrtc-direct':
skipSecureChannel = true
skipMuxer = true
break
case 'webrtc':
// #TODO: We can re-introduce this once https://github.com/libp2p/js-libp2p/issues/1846 is resolved
// case 'webrtc-direct':
skipSecureChannel = true
skipMuxer = true
// Setup yamux and noise to connect to the relay node
options.streamMuxers = [yamux()]
options.connectionEncryption = [noise()]
break
// case 'webrtc':
// skipSecureChannel = true
// skipMuxer = true
// // Setup yamux and noise to connect to the relay node
// options.streamMuxers = [yamux()]
// options.connectionEncryption = [noise()]
// break
default:
// Do nothing
}
Expand Down