mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2024-12-05 02:10:18 +00:00
Swapped secio with noise (#32)
Update libp2p-related packages and switch from secio to noise
This commit is contained in:
parent
6013f623d4
commit
f732a30eb8
3201
package-lock.json
generated
3201
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
@ -23,12 +23,14 @@
|
||||
"cids": "0.8.1",
|
||||
"it-length-prefixed": "3.0.1",
|
||||
"it-pipe": "1.1.0",
|
||||
"libp2p": "0.28.3",
|
||||
"libp2p-mplex": "0.9.5",
|
||||
"libp2p-secio": "0.12.5",
|
||||
"libp2p-websockets": "0.13.6",
|
||||
"libp2p": "0.30.10",
|
||||
"libp2p-crypto": "^0.19.0",
|
||||
"libp2p-mplex": "0.10.2",
|
||||
"libp2p-noise": "2.0.5",
|
||||
"libp2p-websockets": "0.15.3",
|
||||
"loglevel": "1.7.0",
|
||||
"peer-id": "0.13.12",
|
||||
"multiaddr": "^8.1.2",
|
||||
"peer-id": "0.14.3",
|
||||
"uuid": "8.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -44,7 +46,6 @@
|
||||
"babel-plugin-replace-ts-export-assignment": "0.0.2",
|
||||
"esm": "^3.2.25",
|
||||
"jest": "^26.6.3",
|
||||
"libp2p-ts": "https://github.com/ChainSafe/libp2p-ts.git#fca072c9764436ef71f974a211bb1befae432575",
|
||||
"text-encoding": "^0.7.0",
|
||||
"ts-jest": "^26.5.0",
|
||||
"ts-loader": "7.0.5",
|
||||
|
@ -73,8 +73,10 @@ describe('Builtins usage suite', () => {
|
||||
let bpId = 'some';
|
||||
|
||||
let bpIdReturned = await addBlueprint(client, 'test_broken_blueprint', ['test_broken_module'], bpId);
|
||||
let allBps = await getBlueprints(client);
|
||||
const allBpIds = allBps.map(x => x.id);
|
||||
|
||||
expect(bpIdReturned).toEqual(bpId);
|
||||
expect(allBpIds).toContain(bpIdReturned);
|
||||
});
|
||||
|
||||
it('create broken blueprint', async function () {
|
||||
|
@ -16,14 +16,14 @@
|
||||
|
||||
import Websockets from 'libp2p-websockets';
|
||||
import Mplex from 'libp2p-mplex';
|
||||
import SECIO from 'libp2p-secio';
|
||||
import Peer from 'libp2p';
|
||||
import { decode, encode } from 'it-length-prefixed';
|
||||
import pipe from 'it-pipe';
|
||||
import Multiaddr from 'multiaddr';
|
||||
import PeerId from 'peer-id';
|
||||
import * as log from 'loglevel';
|
||||
import { parseParticle, Particle, toPayload } from './particle';
|
||||
import { NOISE } from 'libp2p-noise';
|
||||
import PeerId from 'peer-id';
|
||||
import Multiaddr from 'multiaddr'
|
||||
|
||||
export const PROTOCOL_NAME = '/fluence/faas/1.0.0';
|
||||
|
||||
@ -35,7 +35,7 @@ enum Status {
|
||||
|
||||
export class FluenceConnection {
|
||||
private readonly selfPeerId: PeerId;
|
||||
private node: LibP2p;
|
||||
private node: Peer;
|
||||
private readonly address: Multiaddr;
|
||||
readonly nodePeerId: PeerId;
|
||||
private readonly selfPeerIdStr: string;
|
||||
@ -62,8 +62,7 @@ export class FluenceConnection {
|
||||
modules: {
|
||||
transport: [Websockets],
|
||||
streamMuxer: [Mplex],
|
||||
connEncryption: [SECIO],
|
||||
peerDiscovery: [],
|
||||
connEncryption: [NOISE],
|
||||
},
|
||||
});
|
||||
|
||||
@ -127,7 +126,7 @@ export class FluenceConnection {
|
||||
|
||||
// create outgoing substream
|
||||
const conn = (await this.node.dialProtocol(this.address, PROTOCOL_NAME)) as {
|
||||
stream: Stream;
|
||||
stream;
|
||||
protocol: string;
|
||||
};
|
||||
|
||||
|
@ -257,9 +257,9 @@ export const createService = async (
|
||||
* @param {[string]} nodeId - Optional node peer id to get available blueprints from
|
||||
* @param {[string]} nodeId - Optional node peer id to deploy service to
|
||||
* @param {[number]} ttl - Optional ttl for the particle which does the job
|
||||
* @returns { Array<string> } - List of available blueprints
|
||||
* @returns { Array<object> } - List of available blueprints
|
||||
*/
|
||||
export const getBlueprints = async (client: FluenceClient, nodeId?: string, ttl?: number): Promise<string[]> => {
|
||||
export const getBlueprints = async (client: FluenceClient, nodeId?: string, ttl?: number): Promise<[{dependencies, id: string, name: string}]> => {
|
||||
let returnValue = 'blueprints';
|
||||
let call = (nodeId: string) => `(call "${nodeId}" ("dist" "list_blueprints") [] ${returnValue})`;
|
||||
|
||||
@ -269,7 +269,7 @@ export const getBlueprints = async (client: FluenceClient, nodeId?: string, ttl?
|
||||
call,
|
||||
returnValue,
|
||||
new Map(),
|
||||
(args: any[]) => args[0] as string[],
|
||||
(args: any[]) => args[0],
|
||||
nodeId,
|
||||
ttl,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user