mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-23 14:01:35 +00:00
fix: add yamux interop tests (#1290)
Test stream compatibility with https://www.npmjs.com/package/@chainsafe/libp2p-yamux Co-authored-by: achingbrain <alex@achingbrain.net>
This commit is contained in:
@ -12,6 +12,7 @@ import { execa } from 'execa'
|
||||
import pDefer from 'p-defer'
|
||||
import { logger } from '@libp2p/logger'
|
||||
import { Mplex } from '@libp2p/mplex'
|
||||
import { Yamux } from '@chainsafe/libp2p-yamux'
|
||||
import fs from 'fs'
|
||||
import { unmarshalPrivateKey } from '@libp2p/crypto/keys'
|
||||
import type { PeerId } from '@libp2p/interface-peer-id'
|
||||
@ -93,10 +94,16 @@ async function createJsPeer (options: SpawnOptions): Promise<Daemon> {
|
||||
listen: ['/ip4/0.0.0.0/tcp/0']
|
||||
},
|
||||
transports: [new TCP()],
|
||||
streamMuxers: [new Mplex()],
|
||||
streamMuxers: [],
|
||||
connectionEncryption: [new Noise()]
|
||||
}
|
||||
|
||||
if (options.muxer === 'mplex') {
|
||||
opts.streamMuxers?.push(new Mplex())
|
||||
} else {
|
||||
opts.streamMuxers?.push(new Yamux())
|
||||
}
|
||||
|
||||
if (options.dht === true) {
|
||||
// go-libp2p-daemon only has the older single-table DHT instead of the dual
|
||||
// lan/wan version found in recent go-ipfs versions. unfortunately it's been
|
||||
|
Reference in New Issue
Block a user