mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-03-15 15:30:49 +00:00
FluenceConnection: update libp2p to v0.36.2 (#155)
This commit is contained in:
parent
5234ba24ed
commit
2b752492c1
@ -1,4 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
preset: 'ts-jest',
|
preset: 'ts-jest',
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
|
testTimeout: 10000,
|
||||||
};
|
};
|
||||||
|
16342
package-lock.json
generated
16342
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
44
package.json
44
package.json
@ -25,37 +25,37 @@
|
|||||||
"@chainsafe/libp2p-noise": "^4.1.1",
|
"@chainsafe/libp2p-noise": "^4.1.1",
|
||||||
"@fluencelabs/avm": "0.24.2",
|
"@fluencelabs/avm": "0.24.2",
|
||||||
"@fluencelabs/marine-js": "0.2.5",
|
"@fluencelabs/marine-js": "0.2.5",
|
||||||
"async": "3.2.0",
|
"async": "3.2.3",
|
||||||
"browser-or-node": "^2.0.0",
|
"browser-or-node": "^2.0.0",
|
||||||
"bs58": "4.0.1",
|
"bs58": "5.0.0",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"cids": "0.8.1",
|
"cids": "1.1.9",
|
||||||
"it-length-prefixed": "3.0.1",
|
"it-length-prefixed": "5.0.3",
|
||||||
"it-pipe": "1.1.0",
|
"it-pipe": "1.1.0",
|
||||||
"libp2p": "=0.33.0",
|
"libp2p": "0.36.2",
|
||||||
"libp2p-crypto": "=0.20.0",
|
"libp2p-crypto": "0.21.2",
|
||||||
"libp2p-mplex": "=0.10.2",
|
"libp2p-mplex": "0.10.7",
|
||||||
"libp2p-websockets": "^0.16.2",
|
"libp2p-websockets": "0.16.2",
|
||||||
"loglevel": "1.7.0",
|
"loglevel": "1.8.0",
|
||||||
"multiaddr": "^10.0.1",
|
"multiaddr": "10.0.1",
|
||||||
"multiformats": "^9.6.4",
|
"multiformats": "9.6.5",
|
||||||
"peer-id": "=0.15.4",
|
"peer-id": "0.16.0",
|
||||||
"platform": "^1.3.6",
|
"platform": "^1.3.6",
|
||||||
"rxjs": "^7.3.0",
|
"rxjs": "^7.5.5",
|
||||||
"ts-pattern": "^3.3.3",
|
"ts-pattern": "3.3.3",
|
||||||
"uuid": "8.3.0"
|
"uuid": "8.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fluencelabs/aqua": "^0.7.0-285",
|
"@fluencelabs/aqua": "^0.7.2-307",
|
||||||
"@fluencelabs/aqua-lib": "^0.4.3",
|
"@fluencelabs/aqua-lib": "^0.5.1",
|
||||||
"@types/bs58": "^4.0.1",
|
"@types/bs58": "^4.0.1",
|
||||||
"@types/jest": "^26.0.22",
|
"@types/jest": "^27.5.1",
|
||||||
"@types/platform": "^1.3.4",
|
"@types/platform": "^1.3.4",
|
||||||
"@types/uuid": "^8.3.4",
|
"@types/uuid": "^8.3.4",
|
||||||
"jest": "^26.6.3",
|
"jest": "^28.1.0",
|
||||||
"js-base64": "^3.7.2",
|
"js-base64": "^3.7.2",
|
||||||
"ts-jest": "^26.5.4",
|
"ts-jest": "^28.0.2",
|
||||||
"typedoc": "^0.21.9",
|
"typedoc": "^0.22.15",
|
||||||
"typescript": "^4.0.0"
|
"typescript": "^4.6.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,11 @@ import Websockets from 'libp2p-websockets';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import Mplex from 'libp2p-mplex';
|
import Mplex from 'libp2p-mplex';
|
||||||
import Lib2p2Peer from 'libp2p';
|
import Lib2p2Peer from 'libp2p';
|
||||||
// @ts-ignore
|
|
||||||
import { decode, encode } from 'it-length-prefixed';
|
import { decode, encode } from 'it-length-prefixed';
|
||||||
import pipe from 'it-pipe';
|
import { pipe } from 'it-pipe';
|
||||||
import * as log from 'loglevel';
|
import * as log from 'loglevel';
|
||||||
|
import { Noise } from '@chainsafe/libp2p-noise';
|
||||||
import { Particle } from './Particle';
|
import { Particle } from './Particle';
|
||||||
import { NOISE } from '@chainsafe/libp2p-noise';
|
|
||||||
import PeerId from 'peer-id';
|
import PeerId from 'peer-id';
|
||||||
import { Multiaddr } from 'multiaddr';
|
import { Multiaddr } from 'multiaddr';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -70,7 +69,7 @@ export class FluenceConnection {
|
|||||||
modules: {
|
modules: {
|
||||||
transport: [Websockets],
|
transport: [Websockets],
|
||||||
streamMuxer: [Mplex],
|
streamMuxer: [Mplex],
|
||||||
connEncryption: [NOISE],
|
connEncryption: [new Noise()],
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
transport: {
|
transport: {
|
||||||
@ -85,20 +84,25 @@ export class FluenceConnection {
|
|||||||
});
|
});
|
||||||
|
|
||||||
lib2p2Peer.handle([PROTOCOL_NAME], async ({ connection, stream }) => {
|
lib2p2Peer.handle([PROTOCOL_NAME], async ({ connection, stream }) => {
|
||||||
pipe(stream.source, decode(), async (source: AsyncIterable<string>) => {
|
pipe(
|
||||||
try {
|
stream.source,
|
||||||
for await (const msg of source) {
|
// @ts-ignore
|
||||||
try {
|
decode(),
|
||||||
const particle = Particle.fromString(msg);
|
async (source: AsyncIterable<string>) => {
|
||||||
options.onIncomingParticle(particle);
|
try {
|
||||||
} catch (e) {
|
for await (const msg of source) {
|
||||||
log.error('error on handling a new incoming message: ' + e);
|
try {
|
||||||
|
const particle = Particle.fromString(msg);
|
||||||
|
options.onIncomingParticle(particle);
|
||||||
|
} catch (e) {
|
||||||
|
log.error('error on handling a new incoming message: ' + e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.debug('connection closed: ' + e);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
},
|
||||||
log.debug('connection closed: ' + e);
|
);
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const relayAddress = options.relayAddress;
|
const relayAddress = options.relayAddress;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user