FluenceConnection: update libp2p to v0.36.2 (#155)

This commit is contained in:
Pavel 2022-05-18 15:33:24 +03:00 committed by GitHub
parent 5234ba24ed
commit 2b752492c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5714 additions and 10709 deletions

View File

@ -1,4 +1,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testTimeout: 10000,
};

16500
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,37 +25,37 @@
"@chainsafe/libp2p-noise": "^4.1.1",
"@fluencelabs/avm": "0.24.2",
"@fluencelabs/marine-js": "0.2.5",
"async": "3.2.0",
"async": "3.2.3",
"browser-or-node": "^2.0.0",
"bs58": "4.0.1",
"bs58": "5.0.0",
"buffer": "^6.0.3",
"cids": "0.8.1",
"it-length-prefixed": "3.0.1",
"cids": "1.1.9",
"it-length-prefixed": "5.0.3",
"it-pipe": "1.1.0",
"libp2p": "=0.33.0",
"libp2p-crypto": "=0.20.0",
"libp2p-mplex": "=0.10.2",
"libp2p-websockets": "^0.16.2",
"loglevel": "1.7.0",
"multiaddr": "^10.0.1",
"multiformats": "^9.6.4",
"peer-id": "=0.15.4",
"libp2p": "0.36.2",
"libp2p-crypto": "0.21.2",
"libp2p-mplex": "0.10.7",
"libp2p-websockets": "0.16.2",
"loglevel": "1.8.0",
"multiaddr": "10.0.1",
"multiformats": "9.6.5",
"peer-id": "0.16.0",
"platform": "^1.3.6",
"rxjs": "^7.3.0",
"ts-pattern": "^3.3.3",
"uuid": "8.3.0"
"rxjs": "^7.5.5",
"ts-pattern": "3.3.3",
"uuid": "8.3.2"
},
"devDependencies": {
"@fluencelabs/aqua": "^0.7.0-285",
"@fluencelabs/aqua-lib": "^0.4.3",
"@fluencelabs/aqua": "^0.7.2-307",
"@fluencelabs/aqua-lib": "^0.5.1",
"@types/bs58": "^4.0.1",
"@types/jest": "^26.0.22",
"@types/jest": "^27.5.1",
"@types/platform": "^1.3.4",
"@types/uuid": "^8.3.4",
"jest": "^26.6.3",
"jest": "^28.1.0",
"js-base64": "^3.7.2",
"ts-jest": "^26.5.4",
"typedoc": "^0.21.9",
"typescript": "^4.0.0"
"ts-jest": "^28.0.2",
"typedoc": "^0.22.15",
"typescript": "^4.6.4"
}
}

View File

@ -18,12 +18,11 @@ import Websockets from 'libp2p-websockets';
// @ts-ignore
import Mplex from 'libp2p-mplex';
import Lib2p2Peer from 'libp2p';
// @ts-ignore
import { decode, encode } from 'it-length-prefixed';
import pipe from 'it-pipe';
import { pipe } from 'it-pipe';
import * as log from 'loglevel';
import { Noise } from '@chainsafe/libp2p-noise';
import { Particle } from './Particle';
import { NOISE } from '@chainsafe/libp2p-noise';
import PeerId from 'peer-id';
import { Multiaddr } from 'multiaddr';
// @ts-ignore
@ -70,7 +69,7 @@ export class FluenceConnection {
modules: {
transport: [Websockets],
streamMuxer: [Mplex],
connEncryption: [NOISE],
connEncryption: [new Noise()],
},
config: {
transport: {
@ -85,7 +84,11 @@ export class FluenceConnection {
});
lib2p2Peer.handle([PROTOCOL_NAME], async ({ connection, stream }) => {
pipe(stream.source, decode(), async (source: AsyncIterable<string>) => {
pipe(
stream.source,
// @ts-ignore
decode(),
async (source: AsyncIterable<string>) => {
try {
for await (const msg of source) {
try {
@ -98,7 +101,8 @@ export class FluenceConnection {
} catch (e) {
log.debug('connection closed: ' + e);
}
});
},
);
});
const relayAddress = options.relayAddress;