Skip to content

Commit

Permalink
feat: support yamux muxer (#11)
Browse files Browse the repository at this point in the history
Note: elastic-ipfs/bitswap-peer#205 needs to
merge before yamux will be used with the default peer.
  • Loading branch information
Alan Shaw authored May 18, 2023
1 parent ad25001 commit 24ef997
Show file tree
Hide file tree
Showing 3 changed files with 5,002 additions and 8,985 deletions.
6 changes: 5 additions & 1 deletion p2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createLibp2p } from 'libp2p'
import { webSockets } from '@libp2p/websockets'
import { tcp } from '@libp2p/tcp'
import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { mplex } from '@libp2p/mplex'
import debug from 'debug'
import { multiaddr } from '@multiformats/multiaddr'
Expand All @@ -21,7 +22,10 @@ const log = debug('dagula:p2p')
export async function getLibp2p () {
const libp2p = await createLibp2p({
transports: [webSockets(), tcp()],
streamMuxers: [mplex({ maxMsgSize: 4 * 1024 * 1024 })],
streamMuxers: [
yamux({ direction: 'outbound' }),
mplex({ maxMsgSize: 4 * 1024 * 1024 })
],
connectionEncryption: [noise()]
})
await libp2p.start()
Expand Down
Loading

0 comments on commit 24ef997

Please sign in to comment.