Skip to content

Commit 6c42ea6

Browse files
authored
fix: update multiaddr (#3184)
Updates `@multiformats/multiaddr` to one that implements the `/unix` part of the spec.
1 parent ae595d8 commit 6c42ea6

File tree

55 files changed

+160
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+160
-156
lines changed

interop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@libp2p/webrtc": "^5.2.15",
2525
"@libp2p/websockets": "^9.2.13",
2626
"@libp2p/webtransport": "^5.0.43",
27-
"@multiformats/multiaddr": "^12.4.0",
27+
"@multiformats/multiaddr": "^12.4.4",
2828
"aegir": "^47.0.14",
2929
"libp2p": "^2.8.8",
3030
"p-event": "^6.0.1",

packages/integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@libp2p/webtransport": "^5.0.43",
6060
"@multiformats/dns": "^1.0.6",
6161
"@multiformats/mafmt": "^12.1.6",
62-
"@multiformats/multiaddr": "^12.4.0",
62+
"@multiformats/multiaddr": "^12.4.4",
6363
"@multiformats/multiaddr-matcher": "^1.7.2",
6464
"aegir": "^47.0.14",
6565
"delay": "^6.0.0",

packages/interface-compliance-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"@libp2p/peer-id": "^5.1.6",
109109
"@libp2p/plaintext": "^2.0.26",
110110
"@libp2p/utils": "^6.6.6",
111-
"@multiformats/multiaddr": "^12.4.0",
111+
"@multiformats/multiaddr": "^12.4.4",
112112
"@multiformats/multiaddr-matcher": "^1.7.2",
113113
"abortable-iterator": "^5.1.0",
114114
"aegir": "^47.0.14",

packages/interface-compliance-tests/src/mocks/connection-manager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ class MockConnectionManager implements ConnectionManager, Startable {
104104
return 10_000
105105
}
106106

107+
setMaxConnections (): void {
108+
109+
}
110+
107111
async openConnection (peerId: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<Connection> {
108112
if (isMultiaddr(peerId)) {
109113
throw new UnsupportedOperationError('Dialing multiaddrs not supported')

packages/interface-internal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dependencies": {
4444
"@libp2p/interface": "^2.10.3",
4545
"@libp2p/peer-collections": "^6.0.31",
46-
"@multiformats/multiaddr": "^12.4.0",
46+
"@multiformats/multiaddr": "^12.4.4",
4747
"progress-events": "^1.0.1"
4848
},
4949
"devDependencies": {

packages/interface-internal/src/connection-manager.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ export interface ConnectionManager {
6666
*/
6767
getMaxConnections(): number
6868

69+
/**
70+
* Update the maximum number of connections that are accepted - setting this
71+
* to a smaller value than the current setting will cause connections to be
72+
* pruned.
73+
*/
74+
setMaxConnections(maxConnections: number): void
75+
6976
/**
7077
* Open a connection to a remote peer
7178
*

packages/interface/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"build": "aegir build"
4242
},
4343
"dependencies": {
44-
"@multiformats/multiaddr": "^12.4.0",
44+
"@multiformats/multiaddr": "^12.4.4",
4545
"it-pushable": "^3.2.3",
4646
"it-stream-types": "^2.0.2",
4747
"main-event": "^1.0.1",

packages/kad-dht/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@libp2p/ping": "^2.0.33",
5656
"@libp2p/record": "^4.0.7",
5757
"@libp2p/utils": "^6.6.6",
58-
"@multiformats/multiaddr": "^12.4.0",
58+
"@multiformats/multiaddr": "^12.4.4",
5959
"any-signal": "^4.1.1",
6060
"interface-datastore": "^8.3.1",
6161
"it-all": "^3.0.8",

packages/libp2p/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"@libp2p/peer-store": "^11.2.3",
9191
"@libp2p/utils": "^6.6.6",
9292
"@multiformats/dns": "^1.0.6",
93-
"@multiformats/multiaddr": "^12.4.0",
93+
"@multiformats/multiaddr": "^12.4.4",
9494
"@multiformats/multiaddr-matcher": "^1.7.2",
9595
"any-signal": "^4.1.1",
9696
"datastore-core": "^10.0.2",

packages/libp2p/src/address-manager/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,9 @@ export class AddressManager implements AddressManagerInterface {
365365
return this.announceFilter(
366366
multiaddrs.map(str => {
367367
const ma = multiaddr(str)
368+
const lastComponent = ma.getComponents().pop()
368369

369-
// do not append our peer id to a path multiaddr as it will become invalid
370-
if (ma.protos().pop()?.path === true) {
371-
return ma
372-
}
373-
374-
if (ma.getPeerId() === this.components.peerId.toString()) {
370+
if (lastComponent?.value === this.components.peerId.toString()) {
375371
return ma
376372
}
377373

0 commit comments

Comments
 (0)