From e280a3914b9b73ff944367a13bcb48543e965936 Mon Sep 17 00:00:00 2001 From: Chinmay Kousik Date: Mon, 26 Sep 2022 18:16:58 +0530 Subject: [PATCH 01/10] update upgrader interface --- package.json | 4 +-- src/upgrader.ts | 76 ++++++++++++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 9861754814..2a79cab10a 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ }, "scripts": { "clean": "aegir clean", - "lint": "aegir lint", + "lint": "aegir lint --fix", "dep-check": "aegir dep-check", "prepublishOnly": "node scripts/update-version.js", "build": "aegir build", @@ -116,7 +116,7 @@ "@libp2p/interface-pubsub": "^2.0.1", "@libp2p/interface-registrar": "^2.0.3", "@libp2p/interface-stream-muxer": "^2.0.2", - "@libp2p/interface-transport": "^1.0.3", + "@libp2p/interface-transport": "file:../js-libp2p-interfaces/packages/interface-transport", "@libp2p/interfaces": "^3.0.3", "@libp2p/logger": "^2.0.1", "@libp2p/multistream-select": "^3.0.0", diff --git a/src/upgrader.ts b/src/upgrader.ts index 6b12304721..cacf389a5b 100644 --- a/src/upgrader.ts +++ b/src/upgrader.ts @@ -12,7 +12,7 @@ import type { MultiaddrConnection, Connection, Stream } from '@libp2p/interface- import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface-connection-encrypter' import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface-stream-muxer' import type { PeerId } from '@libp2p/interface-peer-id' -import type { Upgrader, UpgraderEvents } from '@libp2p/interface-transport' +import type { Upgrader, UpgraderEvents, UpgraderOptions } from '@libp2p/interface-transport' import type { Duplex } from 'it-stream-types' import { Components, isInitializable } from '@libp2p/components' import type { AbortOptions } from '@libp2p/interfaces' @@ -228,7 +228,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg /** * Upgrades an outbound connection */ - async upgradeOutbound (maConn: MultiaddrConnection): Promise { + async upgradeOutbound (maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise { const idStr = maConn.remoteAddr.getPeerId() if (idStr == null) { throw errCode(new Error('outbound connection must have a peer id'), codes.ERR_INVALID_MULTIADDR) @@ -240,6 +240,8 @@ export class DefaultUpgrader extends EventEmitter implements Upg throw errCode(new Error('The multiaddr connection is blocked by connectionGater.denyOutboundConnection'), codes.ERR_CONNECTION_INTERCEPTED) } + const skipEncryption = opts?.skipEncryption === true + let encryptedConn let remotePeer let upgradedConn @@ -258,39 +260,53 @@ export class DefaultUpgrader extends EventEmitter implements Upg log('Starting the outbound connection upgrade') + // If the transport natively supports encryption, skip connection + // protector and encryption + // Protect let protectedConn = maConn - const protector = this.components.getConnectionProtector() + if (!skipEncryption) { + const protector = this.components.getConnectionProtector() - if (protector != null) { - protectedConn = await protector.protect(maConn) + if (protector != null) { + protectedConn = await protector.protect(maConn) + } } try { // Encrypt the connection - ({ - conn: encryptedConn, - remotePeer, - protocol: cryptoProtocol - } = await this._encryptOutbound(protectedConn, remotePeerId)) - - if (await this.components.getConnectionGater().denyOutboundEncryptedConnection(remotePeer, { - ...protectedConn, - ...encryptedConn - })) { - throw errCode(new Error('The multiaddr connection is blocked by gater.acceptEncryptedConnection'), codes.ERR_CONNECTION_INTERCEPTED) - } + encryptedConn = protectedConn + if (!skipEncryption) { + ({ + conn: encryptedConn, + remotePeer, + protocol: cryptoProtocol + } = await this._encryptOutbound(protectedConn, remotePeerId)) - // Multiplex the connection - if (this.muxers.size > 0) { - const multiplexed = await this._multiplexOutbound({ + if (await this.components.getConnectionGater().denyOutboundEncryptedConnection(remotePeer, { ...protectedConn, ...encryptedConn - }, this.muxers) - muxerFactory = multiplexed.muxerFactory - upgradedConn = multiplexed.stream + })) { + throw errCode(new Error('The multiaddr connection is blocked by gater.acceptEncryptedConnection'), codes.ERR_CONNECTION_INTERCEPTED) + } } else { - upgradedConn = encryptedConn + // specify this somehow + cryptoProtocol = 'custom' + } + + upgradedConn = encryptedConn + if (opts?.muxerFactory) { + muxerFactory = opts.muxerFactory + } else { + // Multiplex the connection + if (this.muxers.size > 0) { + const multiplexed = await this._multiplexOutbound({ + ...protectedConn, + ...encryptedConn + }, this.muxers) + muxerFactory = multiplexed.muxerFactory + upgradedConn = multiplexed.stream + } } } catch (err: any) { log.error('Failed to upgrade outbound connection', err) @@ -298,7 +314,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg throw err } - if (await this.components.getConnectionGater().denyOutboundUpgradedConnection(remotePeer, { + if (await this.components.getConnectionGater().denyOutboundUpgradedConnection(remotePeerId, { ...protectedConn, ...encryptedConn })) { @@ -306,8 +322,8 @@ export class DefaultUpgrader extends EventEmitter implements Upg } if (metrics != null) { - metrics.updatePlaceholder(proxyPeer, remotePeer) - setPeer(remotePeer) + metrics.updatePlaceholder(proxyPeer, remotePeerId) + setPeer(remotePeerId) } log('Successfully upgraded outbound connection') @@ -318,7 +334,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg maConn, upgradedConn, muxerFactory, - remotePeer + remotePeer: remotePeerId }) } @@ -609,7 +625,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg * Selects one of the given muxers via multistream-select. That * muxer will be used for all future streams on the connection. */ - async _multiplexOutbound (connection: MultiaddrConnection, muxers: Map): Promise<{ stream: Duplex, muxerFactory?: StreamMuxerFactory}> { + async _multiplexOutbound (connection: MultiaddrConnection, muxers: Map): Promise<{stream: Duplex, muxerFactory?: StreamMuxerFactory}> { const protocols = Array.from(muxers.keys()) log('outbound selecting muxer %s', protocols) try { @@ -629,7 +645,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg * Registers support for one of the given muxers via multistream-select. The * selected muxer will be used for all future streams on the connection. */ - async _multiplexInbound (connection: MultiaddrConnection, muxers: Map): Promise<{ stream: Duplex, muxerFactory?: StreamMuxerFactory}> { + async _multiplexInbound (connection: MultiaddrConnection, muxers: Map): Promise<{stream: Duplex, muxerFactory?: StreamMuxerFactory}> { const protocols = Array.from(muxers.keys()) log('inbound handling muxers %s', protocols) try { From 14ca807861ffbe2ec8bd378f72a1e996cbba009d Mon Sep 17 00:00:00 2001 From: Chinmay Kousik Date: Fri, 30 Sep 2022 17:01:31 +0530 Subject: [PATCH 02/10] address review --- package.json | 4 ++-- src/upgrader.ts | 29 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 2a79cab10a..3b0600c44e 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ }, "scripts": { "clean": "aegir clean", - "lint": "aegir lint --fix", + "lint": "aegir lint", "dep-check": "aegir dep-check", "prepublishOnly": "node scripts/update-version.js", "build": "aegir build", @@ -115,7 +115,7 @@ "@libp2p/interface-peer-store": "^1.2.1", "@libp2p/interface-pubsub": "^2.0.1", "@libp2p/interface-registrar": "^2.0.3", - "@libp2p/interface-stream-muxer": "^2.0.2", + "@libp2p/interface-stream-muxer": "file:../js-libp2p-interfaces/packages/interface-stream-muxer", "@libp2p/interface-transport": "file:../js-libp2p-interfaces/packages/interface-transport", "@libp2p/interfaces": "^3.0.3", "@libp2p/logger": "^2.0.1", diff --git a/src/upgrader.ts b/src/upgrader.ts index cacf389a5b..e837025f3f 100644 --- a/src/upgrader.ts +++ b/src/upgrader.ts @@ -265,7 +265,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg // Protect let protectedConn = maConn - if (!skipEncryption) { + if ((opts?.muxerFactory) == null) { const protector = this.components.getConnectionProtector() if (protector != null) { @@ -291,22 +291,21 @@ export class DefaultUpgrader extends EventEmitter implements Upg } } else { // specify this somehow - cryptoProtocol = 'custom' + cryptoProtocol = 'native' + remotePeer = remotePeerId } upgradedConn = encryptedConn - if (opts?.muxerFactory) { + if ((opts?.muxerFactory) != null) { muxerFactory = opts.muxerFactory - } else { + } else if (this.muxers.size > 0) { // Multiplex the connection - if (this.muxers.size > 0) { - const multiplexed = await this._multiplexOutbound({ - ...protectedConn, - ...encryptedConn - }, this.muxers) - muxerFactory = multiplexed.muxerFactory - upgradedConn = multiplexed.stream - } + const multiplexed = await this._multiplexOutbound({ + ...protectedConn, + ...encryptedConn + }, this.muxers) + muxerFactory = multiplexed.muxerFactory + upgradedConn = multiplexed.stream } } catch (err: any) { log.error('Failed to upgrade outbound connection', err) @@ -314,7 +313,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg throw err } - if (await this.components.getConnectionGater().denyOutboundUpgradedConnection(remotePeerId, { + if (await this.components.getConnectionGater().denyOutboundUpgradedConnection(remotePeer, { ...protectedConn, ...encryptedConn })) { @@ -322,7 +321,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg } if (metrics != null) { - metrics.updatePlaceholder(proxyPeer, remotePeerId) + metrics.updatePlaceholder(proxyPeer, remotePeer) setPeer(remotePeerId) } @@ -427,7 +426,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg } log('%s: starting new stream on %s', direction, protocols) - const muxedStream = muxer.newStream() + const muxedStream = await muxer.newStream() const metrics = this.components.getMetrics() let controller: TimeoutController | undefined From 8131cf9c2f4a5d9103bae2c879afd30642d30a40 Mon Sep 17 00:00:00 2001 From: Chinmay Kousik Date: Fri, 30 Sep 2022 20:04:21 +0530 Subject: [PATCH 03/10] address review --- src/upgrader.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/upgrader.ts b/src/upgrader.ts index e837025f3f..03d7d87837 100644 --- a/src/upgrader.ts +++ b/src/upgrader.ts @@ -240,8 +240,6 @@ export class DefaultUpgrader extends EventEmitter implements Upg throw errCode(new Error('The multiaddr connection is blocked by connectionGater.denyOutboundConnection'), codes.ERR_CONNECTION_INTERCEPTED) } - const skipEncryption = opts?.skipEncryption === true - let encryptedConn let remotePeer let upgradedConn @@ -276,7 +274,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg try { // Encrypt the connection encryptedConn = protectedConn - if (!skipEncryption) { + if (!opts?.skipEncryption) { ({ conn: encryptedConn, remotePeer, @@ -290,7 +288,6 @@ export class DefaultUpgrader extends EventEmitter implements Upg throw errCode(new Error('The multiaddr connection is blocked by gater.acceptEncryptedConnection'), codes.ERR_CONNECTION_INTERCEPTED) } } else { - // specify this somehow cryptoProtocol = 'native' remotePeer = remotePeerId } @@ -333,7 +330,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg maConn, upgradedConn, muxerFactory, - remotePeer: remotePeerId + remotePeer, }) } From c6e899cc5be6805ec2630038ff6161ab92db8da8 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 6 Oct 2022 08:03:33 -0700 Subject: [PATCH 04/10] Update version numbers --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3b0600c44e..2ac1315de2 100644 --- a/package.json +++ b/package.json @@ -115,8 +115,8 @@ "@libp2p/interface-peer-store": "^1.2.1", "@libp2p/interface-pubsub": "^2.0.1", "@libp2p/interface-registrar": "^2.0.3", - "@libp2p/interface-stream-muxer": "file:../js-libp2p-interfaces/packages/interface-stream-muxer", - "@libp2p/interface-transport": "file:../js-libp2p-interfaces/packages/interface-transport", + "@libp2p/interface-stream-muxer": "^3.0.0", + "@libp2p/interface-transport": "^2.0.0", "@libp2p/interfaces": "^3.0.3", "@libp2p/logger": "^2.0.1", "@libp2p/multistream-select": "^3.0.0", From de562f4dddbd30ba6ab8026849f6ece53b33a05f Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 6 Oct 2022 13:43:57 -0700 Subject: [PATCH 05/10] Nits and lints --- src/upgrader.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/upgrader.ts b/src/upgrader.ts index 03d7d87837..3055e57b82 100644 --- a/src/upgrader.ts +++ b/src/upgrader.ts @@ -263,7 +263,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg // Protect let protectedConn = maConn - if ((opts?.muxerFactory) == null) { + if (opts?.skipProtection !== true) { const protector = this.components.getConnectionProtector() if (protector != null) { @@ -274,7 +274,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg try { // Encrypt the connection encryptedConn = protectedConn - if (!opts?.skipEncryption) { + if (opts?.skipEncryption !== true) { ({ conn: encryptedConn, remotePeer, @@ -293,7 +293,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg } upgradedConn = encryptedConn - if ((opts?.muxerFactory) != null) { + if (opts?.muxerFactory != null) { muxerFactory = opts.muxerFactory } else if (this.muxers.size > 0) { // Multiplex the connection @@ -330,7 +330,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg maConn, upgradedConn, muxerFactory, - remotePeer, + remotePeer }) } From ac6405f9f076803daf6f1f95ff3aa64441c8c9ed Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Fri, 7 Oct 2022 08:14:16 -0700 Subject: [PATCH 06/10] Update components --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4a58523626..95622ae310 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ }, "dependencies": { "@achingbrain/nat-port-mapper": "^1.0.3", - "@libp2p/components": "^2.1.0", + "@libp2p/components": "^3.0.0", "@libp2p/connection": "^4.0.2", "@libp2p/crypto": "^1.0.4", "@libp2p/interface-address-manager": "^1.0.3", From 249b070b3093208afa6307591d4aa5f61acb2fd1 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Fri, 7 Oct 2022 08:26:13 -0700 Subject: [PATCH 07/10] Update peer-store,tcp,ws --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 95622ae310..1d209f0df7 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "@libp2p/peer-id": "^1.1.15", "@libp2p/peer-id-factory": "^1.0.18", "@libp2p/peer-record": "^4.0.3", - "@libp2p/peer-store": "^3.1.5", + "@libp2p/peer-store": "^4.0.0", "@libp2p/tracked-map": "^2.0.1", "@libp2p/utils": "^3.0.2", "@multiformats/mafmt": "^11.0.2", @@ -183,10 +183,10 @@ "@libp2p/mdns": "^3.0.1", "@libp2p/mplex": "^5.2.3", "@libp2p/pubsub": "^3.1.3", - "@libp2p/tcp": "^3.1.1", + "@libp2p/tcp": "^4.0.0", "@libp2p/topology": "^3.0.1", "@libp2p/webrtc-star": "^3.0.3", - "@libp2p/websockets": "^3.0.4", + "@libp2p/websockets": "^4.0.0", "@types/node-forge": "^1.0.0", "@types/p-fifo": "^1.0.0", "@types/varint": "^6.0.0", From f035724698d2557c858c81d946170abf1131d038 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 7 Oct 2022 17:38:34 +0100 Subject: [PATCH 08/10] fix: update all deps to latest versions Pulls in changes from `@libp2p/interface-transport`, `@libp2p/components` etc. --- examples/delegated-routing/package.json | 14 ++++++------- examples/libp2p-in-the-browser/package.json | 8 ++++---- examples/package.json | 2 +- examples/webrtc-direct/package.json | 8 ++++---- package.json | 22 ++++++++++----------- src/address-manager/index.ts | 17 ++++++++++++++++ 6 files changed, 44 insertions(+), 27 deletions(-) diff --git a/examples/delegated-routing/package.json b/examples/delegated-routing/package.json index fc3cae70c8..a136e8433a 100644 --- a/examples/delegated-routing/package.json +++ b/examples/delegated-routing/package.json @@ -3,15 +3,15 @@ "version": "0.1.0", "private": true, "dependencies": { - "@chainsafe/libp2p-noise": "^8.0.2", + "@chainsafe/libp2p-noise": "^9.0.0", "ipfs-core": "^0.15.4", "libp2p": "../../", - "@libp2p/delegated-content-routing": "^2.0.1", - "@libp2p/delegated-peer-routing": "^2.0.1", - "@libp2p/kad-dht": "^3.0.0", - "@libp2p/mplex": "^5.2.3", - "@libp2p/webrtc-star": "^3.0.3", - "@libp2p/websockets": "^3.0.4", + "@libp2p/delegated-content-routing": "^2.0.2", + "@libp2p/delegated-peer-routing": "^2.0.2", + "@libp2p/kad-dht": "^4.0.0", + "@libp2p/mplex": "^6.0.2", + "@libp2p/webrtc-star": "^4.0.1", + "@libp2p/websockets": "^4.0.0", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "5.0.0" diff --git a/examples/libp2p-in-the-browser/package.json b/examples/libp2p-in-the-browser/package.json index 2abd84345f..3e24693520 100644 --- a/examples/libp2p-in-the-browser/package.json +++ b/examples/libp2p-in-the-browser/package.json @@ -9,10 +9,10 @@ }, "license": "ISC", "dependencies": { - "@chainsafe/libp2p-noise": "^8.0.2", - "@libp2p/bootstrap": "^2.0.1", - "@libp2p/mplex": "^5.2.3", - "@libp2p/webrtc-star": "^3.0.3", + "@chainsafe/libp2p-noise": "^9.0.0", + "@libp2p/bootstrap": "^4.0.0", + "@libp2p/mplex": "^6.0.2", + "@libp2p/webrtc-star": "^4.0.1", "@libp2p/websockets": "^3.0.4", "libp2p": "../../" }, diff --git a/examples/package.json b/examples/package.json index c3baa68c9d..a43e2a9df1 100644 --- a/examples/package.json +++ b/examples/package.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@libp2p/pubsub-peer-discovery": "^6.0.2", - "@libp2p/floodsub": "^3.0.3", + "@libp2p/floodsub": "^4.0.0", "@nodeutils/defaults-deep": "^1.1.0", "execa": "^6.1.0", "fs-extra": "^10.1.0", diff --git a/examples/webrtc-direct/package.json b/examples/webrtc-direct/package.json index 37c08976b2..b42ffa5d4a 100644 --- a/examples/webrtc-direct/package.json +++ b/examples/webrtc-direct/package.json @@ -9,10 +9,10 @@ }, "license": "ISC", "dependencies": { - "@libp2p/webrtc-direct": "^2.0.0", - "@chainsafe/libp2p-noise": "^8.0.2", - "@libp2p/bootstrap": "^2.0.1", - "@libp2p/mplex": "^5.2.3", + "@libp2p/webrtc-direct": "^2.0.3", + "@chainsafe/libp2p-noise": "^9.0.0", + "@libp2p/bootstrap": "^4.0.0", + "@libp2p/mplex": "^6.0.2", "libp2p": "../../", "wrtc": "^0.4.7" }, diff --git a/package.json b/package.json index 1d209f0df7..2ad2304a60 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "@libp2p/components": "^3.0.0", "@libp2p/connection": "^4.0.2", "@libp2p/crypto": "^1.0.4", - "@libp2p/interface-address-manager": "^1.0.3", + "@libp2p/interface-address-manager": "^2.0.0", "@libp2p/interface-connection": "^3.0.2", "@libp2p/interface-connection-encrypter": "^3.0.1", "@libp2p/interface-connection-manager": "^1.1.1", @@ -169,23 +169,23 @@ "xsalsa20": "^1.1.0" }, "devDependencies": { - "@chainsafe/libp2p-noise": "^8.0.2", - "@chainsafe/libp2p-yamux": "^1.0.0", - "@libp2p/bootstrap": "^3.0.0", + "@chainsafe/libp2p-noise": "^9.0.0", + "@chainsafe/libp2p-yamux": "^2.0.0", + "@libp2p/bootstrap": "^4.0.0", "@libp2p/daemon-client": "^3.0.1", "@libp2p/daemon-server": "^3.0.1", - "@libp2p/floodsub": "^3.0.0", + "@libp2p/floodsub": "^4.0.0", "@libp2p/interface-compliance-tests": "^3.0.2", "@libp2p/interface-connection-encrypter-compliance-tests": "^2.0.2", - "@libp2p/interface-mocks": "^5.1.0", + "@libp2p/interface-mocks": "^6.0.1", "@libp2p/interop": "^3.0.1", - "@libp2p/kad-dht": "^3.0.5", - "@libp2p/mdns": "^3.0.1", - "@libp2p/mplex": "^5.2.3", - "@libp2p/pubsub": "^3.1.3", + "@libp2p/kad-dht": "^4.0.0", + "@libp2p/mdns": "^4.0.0", + "@libp2p/mplex": "^6.0.2", + "@libp2p/pubsub": "^4.0.0", "@libp2p/tcp": "^4.0.0", "@libp2p/topology": "^3.0.1", - "@libp2p/webrtc-star": "^3.0.3", + "@libp2p/webrtc-star": "^4.0.1", "@libp2p/websockets": "^4.0.0", "@types/node-forge": "^1.0.0", "@types/p-fifo": "^1.0.0", diff --git a/src/address-manager/index.ts b/src/address-manager/index.ts index b6726994c3..4b680c7f10 100644 --- a/src/address-manager/index.ts +++ b/src/address-manager/index.ts @@ -76,6 +76,23 @@ export class DefaultAddressManager extends EventEmitter { return Array.from(this.observed).map((a) => multiaddr(a)) } + /** + * Add peer observed addresses + * Signal that we have confidence an observed multiaddr is publicly dialable - + * this will make it appear in the output of getAddresses() + */ + confirmObservedAddr (addr: Multiaddr): void { + + } + + /** + * Signal that we do not have confidence an observed multiaddr is publicly dialable - + * this will remove it from the output of getObservedAddrs() + */ + removeObservedAddr (addr: Multiaddr): void { + + } + /** * Add peer observed addresses */ From 85c36c6af336c5d940c08393de11ce891a01e4eb Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Fri, 7 Oct 2022 11:33:33 -0700 Subject: [PATCH 09/10] Fix indent --- src/address-manager/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/address-manager/index.ts b/src/address-manager/index.ts index 4b680c7f10..907f30a8c5 100644 --- a/src/address-manager/index.ts +++ b/src/address-manager/index.ts @@ -81,17 +81,17 @@ export class DefaultAddressManager extends EventEmitter { * Signal that we have confidence an observed multiaddr is publicly dialable - * this will make it appear in the output of getAddresses() */ - confirmObservedAddr (addr: Multiaddr): void { + confirmObservedAddr (addr: Multiaddr): void { - } + } - /** - * Signal that we do not have confidence an observed multiaddr is publicly dialable - - * this will remove it from the output of getObservedAddrs() - */ - removeObservedAddr (addr: Multiaddr): void { + /** + * Signal that we do not have confidence an observed multiaddr is publicly dialable - + * this will remove it from the output of getObservedAddrs() + */ + removeObservedAddr (addr: Multiaddr): void { - } + } /** * Add peer observed addresses From 39ba7cddeba4c810d74b9b5854d23c817834ac21 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Fri, 7 Oct 2022 13:30:09 -0700 Subject: [PATCH 10/10] Fix setPeer --- src/upgrader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/upgrader.ts b/src/upgrader.ts index 6970b469cc..6f2ba74c84 100644 --- a/src/upgrader.ts +++ b/src/upgrader.ts @@ -326,7 +326,7 @@ export class DefaultUpgrader extends EventEmitter implements Upg if (metrics != null) { metrics.updatePlaceholder(proxyPeer, remotePeer) - setPeer(remotePeerId) + setPeer(remotePeer) } log('Successfully upgraded outbound connection')