This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use abstract stream class from muxer interface module (#165)
Refactors the stream class in this module to use the abstract superclass from `@libp2p/interface-stream-muxer` as it handles all the various scenarios for closing streams which this module does not. Fixes #164
- Loading branch information
1 parent
0e0cc8c
commit 32f68de
Showing
8 changed files
with
522 additions
and
552 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,59 @@ | ||
import { createLibp2p } from 'libp2p' | ||
import { circuitRelayServer } from 'libp2p/circuit-relay' | ||
import { identifyService } from 'libp2p/identify' | ||
import { webSockets } from '@libp2p/websockets' | ||
import { noise } from '@chainsafe/libp2p-noise' | ||
import { yamux } from '@chainsafe/libp2p-yamux' | ||
|
||
export default { | ||
build: { | ||
config: { | ||
platform: 'node' | ||
}, | ||
bundlesizeMax: '117KB' | ||
}, | ||
test: { | ||
before: async () => { | ||
// start a relay node for use in the tests | ||
const relay = await createLibp2p({ | ||
addresses: { | ||
listen: [ | ||
'/ip4/127.0.0.1/tcp/0/ws' | ||
] | ||
}, | ||
transports: [ | ||
webSockets() | ||
], | ||
connectionEncryption: [ | ||
noise() | ||
], | ||
streamMuxers: [ | ||
yamux() | ||
], | ||
services: { | ||
relay: circuitRelayServer({ | ||
reservations: { | ||
maxReservations: Infinity | ||
} | ||
}), | ||
identify: identifyService() | ||
}, | ||
connectionManager: { | ||
minConnections: 0 | ||
} | ||
}) | ||
|
||
const multiaddrs = relay.getMultiaddrs().map(ma => ma.toString()) | ||
|
||
return { | ||
relay, | ||
env: { | ||
RELAY_MULTIADDR: multiaddrs[0] | ||
} | ||
} | ||
}, | ||
after: async (_, before) => { | ||
await before.relay.stop() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.