mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-15 10:11:22 +00:00
refactor: crypto and pnet (#469)
* feat: add initial plaintext 2 module * refactor: initial refactor of pnet * chore: fix lint * fix: update plaintext api usage * test: use plaintext for test crypto * chore: update deps test: update dialer suite scope * feat: add connection protection to the upgrader * refactor: cleanup and lint fix * chore: remove unncessary transforms * chore: temporarily disable bundlesize * chore: add missing dep * fix: use it-handshake to prevent overreading * chore(fix): PR feedback updates * chore: apply suggestions from code review Co-Authored-By: Vasco Santos <vasco.santos@moxy.studio>
This commit is contained in:
@ -90,7 +90,7 @@ class Libp2p extends EventEmitter {
|
||||
if (this._modules.connEncryption) {
|
||||
const cryptos = this._modules.connEncryption
|
||||
cryptos.forEach((crypto) => {
|
||||
this.upgrader.cryptos.set(crypto.tag, crypto)
|
||||
this.upgrader.cryptos.set(crypto.protocol, crypto)
|
||||
})
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ class Libp2p extends EventEmitter {
|
||||
|
||||
// Attach private network protector
|
||||
if (this._modules.connProtector) {
|
||||
this._switch.protector = this._modules.connProtector
|
||||
this.upgrader.protector = this._modules.connProtector
|
||||
} else if (process.env.LIBP2P_FORCE_PNET) {
|
||||
throw new Error('Private network is enforced, but no protector was provided')
|
||||
}
|
||||
@ -229,6 +229,7 @@ class Libp2p extends EventEmitter {
|
||||
|
||||
try {
|
||||
await this.transportManager.close()
|
||||
await this._switch.stop()
|
||||
} catch (err) {
|
||||
if (err) {
|
||||
log.error(err)
|
||||
|
Reference in New Issue
Block a user