mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2024-12-11 05:00:18 +00:00
fix: Update libp2p deps (#419)
* Update libp2p packages * Try another libp2p version * Add test resolutions * Bump ver * remove override * redo removing override * fix * Fix * Fix * Fix * Fix * Deny connections from internal nox network * Fix eslint * Fix review
This commit is contained in:
parent
5696e3beba
commit
a8a14735b3
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"root": true,
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2022,
|
"ecmaVersion": 2022,
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"author": "Fluence Labs",
|
"author": "Fluence Labs",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@libp2p/utils": "5.2.2",
|
||||||
"@chainsafe/libp2p-noise": "14.0.0",
|
"@chainsafe/libp2p-noise": "14.0.0",
|
||||||
"@chainsafe/libp2p-yamux": "6.0.1",
|
"@chainsafe/libp2p-yamux": "6.0.1",
|
||||||
"@fluencelabs/avm": "0.55.0",
|
"@fluencelabs/avm": "0.55.0",
|
||||||
@ -37,21 +38,21 @@
|
|||||||
"@fluencelabs/js-client-isomorphic": "workspace:*",
|
"@fluencelabs/js-client-isomorphic": "workspace:*",
|
||||||
"@fluencelabs/marine-worker": "0.5.1",
|
"@fluencelabs/marine-worker": "0.5.1",
|
||||||
"@fluencelabs/threads": "^2.0.0",
|
"@fluencelabs/threads": "^2.0.0",
|
||||||
"@libp2p/crypto": "3.0.1",
|
"@libp2p/crypto": "4.0.1",
|
||||||
"@libp2p/identify": "1.0.4",
|
"@libp2p/identify": "1.0.11",
|
||||||
"@libp2p/interface": "1.0.1",
|
"@libp2p/interface": "1.1.2",
|
||||||
"@libp2p/peer-id": "4.0.1",
|
"@libp2p/peer-id": "4.0.5",
|
||||||
"@libp2p/peer-id-factory": "4.0.0",
|
"@libp2p/peer-id-factory": "4.0.5",
|
||||||
"@libp2p/ping": "1.0.4",
|
"@libp2p/ping": "1.0.10",
|
||||||
"@libp2p/websockets": "8.0.5",
|
"@libp2p/websockets": "8.0.12",
|
||||||
"@multiformats/multiaddr": "11.3.0",
|
"@multiformats/multiaddr": "12.1.12",
|
||||||
"bs58": "5.0.0",
|
"bs58": "5.0.0",
|
||||||
"debug": "4.3.4",
|
"debug": "4.3.4",
|
||||||
"it-length-prefixed": "9.0.3",
|
"it-length-prefixed": "9.0.3",
|
||||||
"it-map": "3.0.5",
|
"it-map": "3.0.5",
|
||||||
"it-pipe": "3.0.1",
|
"it-pipe": "3.0.1",
|
||||||
"js-base64": "3.7.5",
|
"js-base64": "3.7.5",
|
||||||
"libp2p": "1.0.7",
|
"libp2p": "1.2.0",
|
||||||
"multiformats": "11.0.1",
|
"multiformats": "11.0.1",
|
||||||
"rxjs": "7.5.5",
|
"rxjs": "7.5.5",
|
||||||
"uint8arrays": "4.0.3",
|
"uint8arrays": "4.0.3",
|
||||||
|
@ -80,6 +80,23 @@ export interface RelayConnectionConfig {
|
|||||||
maxOutboundStreams: number;
|
maxOutboundStreams: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DenyCondition = (ma: Multiaddr) => boolean;
|
||||||
|
|
||||||
|
const dockerNoxDenyCondition: DenyCondition = (ma) => {
|
||||||
|
const [routingProtocol] = ma.stringTuples();
|
||||||
|
const host = routingProtocol?.[1];
|
||||||
|
|
||||||
|
// Nox proposes 3 multiaddr to discover when used inside docker network,
|
||||||
|
// e.g.: [/dns/nox-1, /ip4/10.50.10.10, /ip4/127.0.0.1]
|
||||||
|
// First 2 of them are unreachable outside the docker network
|
||||||
|
// Libp2p cannot handle these scenarios correctly, creating interruptions which affect e2e tests execution.
|
||||||
|
return (
|
||||||
|
host === undefined || host.startsWith("nox-") || host.startsWith("10.50.10")
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const denyConditions = [dockerNoxDenyCondition];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation for JS peers which connects to Fluence through relay node
|
* Implementation for JS peers which connects to Fluence through relay node
|
||||||
*/
|
*/
|
||||||
@ -128,13 +145,18 @@ export class RelayConnection implements IConnection {
|
|||||||
...(this.config.dialTimeoutMs !== undefined
|
...(this.config.dialTimeoutMs !== undefined
|
||||||
? {
|
? {
|
||||||
dialTimeout: this.config.dialTimeoutMs,
|
dialTimeout: this.config.dialTimeoutMs,
|
||||||
|
autoDialInterval: 0,
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
},
|
},
|
||||||
connectionGater: {
|
connectionGater: {
|
||||||
// By default, this function forbids connections to private peers. For example multiaddr with ip 127.0.0.1 isn't allowed
|
// By default, this function forbids connections to private peers. For example, multiaddr with ip 127.0.0.1 isn't allowed
|
||||||
denyDialMultiaddr: () => {
|
denyDialMultiaddr: (ma: Multiaddr) => {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(
|
||||||
|
denyConditions.some((dc) => {
|
||||||
|
return dc(ma);
|
||||||
|
}),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
services: {
|
services: {
|
||||||
|
7010
pnpm-lock.yaml
generated
7010
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user