mirror of
https://github.com/waku-org/js-waku.git
synced 2025-01-11 21:15:01 +00:00
chore: rename node interfaces to include Node
in name
Also rename node with only relay to `RelayNode`.
This commit is contained in:
parent
d946e443ad
commit
f743cfd1ca
@ -15,12 +15,7 @@ import {
|
|||||||
} from "@waku/core";
|
} from "@waku/core";
|
||||||
import { DefaultUserAgent } from "@waku/core";
|
import { DefaultUserAgent } from "@waku/core";
|
||||||
import { getPredefinedBootstrapNodes } from "@waku/core/lib/predefined_bootstrap_nodes";
|
import { getPredefinedBootstrapNodes } from "@waku/core/lib/predefined_bootstrap_nodes";
|
||||||
import type {
|
import type { FullNode, IRelay, LightNode, RelayNode } from "@waku/interfaces";
|
||||||
IRelay,
|
|
||||||
WakuFull,
|
|
||||||
WakuLight,
|
|
||||||
WakuPrivacy,
|
|
||||||
} from "@waku/interfaces";
|
|
||||||
import { wakuPeerExchange } from "@waku/peer-exchange";
|
import { wakuPeerExchange } from "@waku/peer-exchange";
|
||||||
import type { Libp2p } from "libp2p";
|
import type { Libp2p } from "libp2p";
|
||||||
import { createLibp2p, Libp2pOptions } from "libp2p";
|
import { createLibp2p, Libp2pOptions } from "libp2p";
|
||||||
@ -74,7 +69,7 @@ export interface CreateOptions {
|
|||||||
*/
|
*/
|
||||||
export async function createLightNode(
|
export async function createLightNode(
|
||||||
options?: CreateOptions & WakuOptions
|
options?: CreateOptions & WakuOptions
|
||||||
): Promise<WakuLight> {
|
): Promise<LightNode> {
|
||||||
const libp2pOptions = options?.libp2p ?? {};
|
const libp2pOptions = options?.libp2p ?? {};
|
||||||
const peerDiscovery = libp2pOptions.peerDiscovery ?? [];
|
const peerDiscovery = libp2pOptions.peerDiscovery ?? [];
|
||||||
if (options?.defaultBootstrap) {
|
if (options?.defaultBootstrap) {
|
||||||
@ -100,16 +95,16 @@ export async function createLightNode(
|
|||||||
lightPush,
|
lightPush,
|
||||||
filter,
|
filter,
|
||||||
peerExchange
|
peerExchange
|
||||||
) as WakuLight;
|
) as LightNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Waku node that uses Waku Relay to send and receive messages,
|
* Create a Waku node that uses Waku Relay to send and receive messages,
|
||||||
* enabling some privacy preserving properties.
|
* enabling some privacy preserving properties.
|
||||||
*/
|
*/
|
||||||
export async function createPrivacyNode(
|
export async function createRelayNode(
|
||||||
options?: CreateOptions & WakuOptions & Partial<RelayCreateOptions>
|
options?: CreateOptions & WakuOptions & Partial<RelayCreateOptions>
|
||||||
): Promise<WakuPrivacy> {
|
): Promise<RelayNode> {
|
||||||
const libp2pOptions = options?.libp2p ?? {};
|
const libp2pOptions = options?.libp2p ?? {};
|
||||||
const peerDiscovery = libp2pOptions.peerDiscovery ?? [];
|
const peerDiscovery = libp2pOptions.peerDiscovery ?? [];
|
||||||
if (options?.defaultBootstrap) {
|
if (options?.defaultBootstrap) {
|
||||||
@ -123,7 +118,7 @@ export async function createPrivacyNode(
|
|||||||
options?.userAgent
|
options?.userAgent
|
||||||
);
|
);
|
||||||
|
|
||||||
return new WakuNode(options ?? {}, libp2p) as WakuPrivacy;
|
return new WakuNode(options ?? {}, libp2p) as RelayNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,7 +136,7 @@ export async function createPrivacyNode(
|
|||||||
*/
|
*/
|
||||||
export async function createFullNode(
|
export async function createFullNode(
|
||||||
options?: CreateOptions & WakuOptions & Partial<RelayCreateOptions>
|
options?: CreateOptions & WakuOptions & Partial<RelayCreateOptions>
|
||||||
): Promise<WakuFull> {
|
): Promise<FullNode> {
|
||||||
const libp2pOptions = options?.libp2p ?? {};
|
const libp2pOptions = options?.libp2p ?? {};
|
||||||
const peerDiscovery = libp2pOptions.peerDiscovery ?? [];
|
const peerDiscovery = libp2pOptions.peerDiscovery ?? [];
|
||||||
if (options?.defaultBootstrap) {
|
if (options?.defaultBootstrap) {
|
||||||
@ -167,7 +162,7 @@ export async function createFullNode(
|
|||||||
lightPush,
|
lightPush,
|
||||||
filter,
|
filter,
|
||||||
peerExchange
|
peerExchange
|
||||||
) as WakuFull;
|
) as FullNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function defaultPeerDiscovery(): (
|
export function defaultPeerDiscovery(): (
|
||||||
|
@ -27,7 +27,7 @@ export interface Waku {
|
|||||||
isStarted(): boolean;
|
isStarted(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WakuLight extends Waku {
|
export interface LightNode extends Waku {
|
||||||
relay: undefined;
|
relay: undefined;
|
||||||
store: IStore;
|
store: IStore;
|
||||||
filter: IFilter;
|
filter: IFilter;
|
||||||
@ -35,7 +35,7 @@ export interface WakuLight extends Waku {
|
|||||||
peerExchange: IPeerExchange;
|
peerExchange: IPeerExchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WakuPrivacy extends Waku {
|
export interface RelayNode extends Waku {
|
||||||
relay: IRelay;
|
relay: IRelay;
|
||||||
store: undefined;
|
store: undefined;
|
||||||
filter: undefined;
|
filter: undefined;
|
||||||
@ -43,7 +43,7 @@ export interface WakuPrivacy extends Waku {
|
|||||||
peerExchange: undefined;
|
peerExchange: undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WakuFull extends Waku {
|
export interface FullNode extends Waku {
|
||||||
relay: IRelay;
|
relay: IRelay;
|
||||||
store: IStore;
|
store: IStore;
|
||||||
filter: IFilter;
|
filter: IFilter;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { waitForRemotePeer } from "@waku/core";
|
import { waitForRemotePeer } from "@waku/core";
|
||||||
import { createPrivacyNode } from "@waku/create";
|
import { createRelayNode } from "@waku/create";
|
||||||
import { ENR } from "@waku/enr";
|
import { ENR } from "@waku/enr";
|
||||||
import type { WakuPrivacy } from "@waku/interfaces";
|
import type { RelayNode } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src/index.js";
|
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src/index.js";
|
||||||
|
|
||||||
describe("ENR Interop: nwaku", function () {
|
describe("ENR Interop: nwaku", function () {
|
||||||
let waku: WakuPrivacy;
|
let waku: RelayNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
@ -27,7 +27,7 @@ describe("ENR Interop: nwaku", function () {
|
|||||||
});
|
});
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
waku = await createPrivacyNode({
|
waku = await createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
@ -59,7 +59,7 @@ describe("ENR Interop: nwaku", function () {
|
|||||||
});
|
});
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
waku = await createPrivacyNode({
|
waku = await createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
@ -91,7 +91,7 @@ describe("ENR Interop: nwaku", function () {
|
|||||||
});
|
});
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
waku = await createPrivacyNode({
|
waku = await createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
} from "@waku/core";
|
} from "@waku/core";
|
||||||
import { createLightNode } from "@waku/create";
|
import { createLightNode } from "@waku/create";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import type { WakuLight } from "@waku/interfaces";
|
import type { LightNode } from "@waku/interfaces";
|
||||||
import {
|
import {
|
||||||
createDecoder as eciesDecoder,
|
createDecoder as eciesDecoder,
|
||||||
createEncoder as eciesEncoder,
|
createEncoder as eciesEncoder,
|
||||||
@ -37,7 +37,7 @@ const TestEncoder = createEncoder(TestContentTopic);
|
|||||||
const TestDecoder = createDecoder(TestContentTopic);
|
const TestDecoder = createDecoder(TestContentTopic);
|
||||||
|
|
||||||
describe("Waku Message Ephemeral field", () => {
|
describe("Waku Message Ephemeral field", () => {
|
||||||
let waku: WakuLight;
|
let waku: LightNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
waitForRemotePeer,
|
waitForRemotePeer,
|
||||||
} from "@waku/core";
|
} from "@waku/core";
|
||||||
import { createLightNode } from "@waku/create";
|
import { createLightNode } from "@waku/create";
|
||||||
import type { WakuLight } from "@waku/interfaces";
|
import type { LightNode } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import debug from "debug";
|
import debug from "debug";
|
||||||
@ -20,7 +20,7 @@ const TestEncoder = createEncoder(TestContentTopic);
|
|||||||
const TestDecoder = createDecoder(TestContentTopic);
|
const TestDecoder = createDecoder(TestContentTopic);
|
||||||
|
|
||||||
describe("Waku Filter", () => {
|
describe("Waku Filter", () => {
|
||||||
let waku: WakuLight;
|
let waku: LightNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||||
import { createEncoder, waitForRemotePeer } from "@waku/core";
|
import { createEncoder, waitForRemotePeer } from "@waku/core";
|
||||||
import { createLightNode } from "@waku/create";
|
import { createLightNode } from "@waku/create";
|
||||||
import type { WakuLight } from "@waku/interfaces";
|
import type { LightNode } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import debug from "debug";
|
import debug from "debug";
|
||||||
@ -20,7 +20,7 @@ const TestContentTopic = "/test/1/waku-light-push/utf8";
|
|||||||
const TestEncoder = createEncoder(TestContentTopic);
|
const TestEncoder = createEncoder(TestContentTopic);
|
||||||
|
|
||||||
describe("Waku Light Push [node only]", () => {
|
describe("Waku Light Push [node only]", () => {
|
||||||
let waku: WakuLight;
|
let waku: LightNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
@ -7,8 +7,8 @@ import {
|
|||||||
DefaultPubSubTopic,
|
DefaultPubSubTopic,
|
||||||
waitForRemotePeer,
|
waitForRemotePeer,
|
||||||
} from "@waku/core";
|
} from "@waku/core";
|
||||||
import { createPrivacyNode } from "@waku/create";
|
import { createRelayNode } from "@waku/create";
|
||||||
import type { WakuPrivacy } from "@waku/interfaces";
|
import type { RelayNode } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import {
|
import {
|
||||||
createDecoder as createEciesDecoder,
|
createDecoder as createEciesDecoder,
|
||||||
@ -50,17 +50,17 @@ describe("Waku Relay [node only]", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let waku1: WakuPrivacy;
|
let waku1: RelayNode;
|
||||||
let waku2: WakuPrivacy;
|
let waku2: RelayNode;
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
|
|
||||||
log("Starting JS Waku instances");
|
log("Starting JS Waku instances");
|
||||||
[waku1, waku2] = await Promise.all([
|
[waku1, waku2] = await Promise.all([
|
||||||
createPrivacyNode({ staticNoiseKey: NOISE_KEY_1 }).then((waku) =>
|
createRelayNode({ staticNoiseKey: NOISE_KEY_1 }).then((waku) =>
|
||||||
waku.start().then(() => waku)
|
waku.start().then(() => waku)
|
||||||
),
|
),
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_2,
|
staticNoiseKey: NOISE_KEY_2,
|
||||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
@ -250,9 +250,9 @@ describe("Waku Relay [node only]", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Custom pubsub topic", () => {
|
describe("Custom pubsub topic", () => {
|
||||||
let waku1: WakuPrivacy;
|
let waku1: RelayNode;
|
||||||
let waku2: WakuPrivacy;
|
let waku2: RelayNode;
|
||||||
let waku3: WakuPrivacy;
|
let waku3: RelayNode;
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
!!waku1 &&
|
!!waku1 &&
|
||||||
waku1.stop().catch((e) => console.log("Waku failed to stop", e));
|
waku1.stop().catch((e) => console.log("Waku failed to stop", e));
|
||||||
@ -270,16 +270,16 @@ describe("Waku Relay [node only]", () => {
|
|||||||
// 1 and 2 uses a custom pubsub
|
// 1 and 2 uses a custom pubsub
|
||||||
// 3 uses the default pubsub
|
// 3 uses the default pubsub
|
||||||
[waku1, waku2, waku3] = await Promise.all([
|
[waku1, waku2, waku3] = await Promise.all([
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
pubSubTopic: pubSubTopic,
|
pubSubTopic: pubSubTopic,
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
pubSubTopic: pubSubTopic,
|
pubSubTopic: pubSubTopic,
|
||||||
staticNoiseKey: NOISE_KEY_2,
|
staticNoiseKey: NOISE_KEY_2,
|
||||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_3,
|
staticNoiseKey: NOISE_KEY_3,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
]);
|
]);
|
||||||
@ -331,12 +331,12 @@ describe("Waku Relay [node only]", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Interop: nwaku", function () {
|
describe("Interop: nwaku", function () {
|
||||||
let waku: WakuPrivacy;
|
let waku: RelayNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(30_000);
|
this.timeout(30_000);
|
||||||
waku = await createPrivacyNode({
|
waku = await createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
@ -416,8 +416,8 @@ describe("Waku Relay [node only]", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe.skip("Two nodes connected to nwaku", function () {
|
describe.skip("Two nodes connected to nwaku", function () {
|
||||||
let waku1: WakuPrivacy;
|
let waku1: RelayNode;
|
||||||
let waku2: WakuPrivacy;
|
let waku2: RelayNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
@ -431,11 +431,11 @@ describe("Waku Relay [node only]", () => {
|
|||||||
it("Js publishes, other Js receives", async function () {
|
it("Js publishes, other Js receives", async function () {
|
||||||
this.timeout(60_000);
|
this.timeout(60_000);
|
||||||
[waku1, waku2] = await Promise.all([
|
[waku1, waku2] = await Promise.all([
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
emitSelf: true,
|
emitSelf: true,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_2,
|
staticNoiseKey: NOISE_KEY_2,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
]);
|
]);
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
waitForRemotePeer,
|
waitForRemotePeer,
|
||||||
} from "@waku/core";
|
} from "@waku/core";
|
||||||
import { createLightNode } from "@waku/create";
|
import { createLightNode } from "@waku/create";
|
||||||
import type { IDecodedMessage, IMessage, WakuLight } from "@waku/interfaces";
|
import type { IDecodedMessage, IMessage, LightNode } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import {
|
import {
|
||||||
createDecoder as createEciesDecoder,
|
createDecoder as createEciesDecoder,
|
||||||
@ -38,7 +38,7 @@ const TestEncoder = createEncoder(TestContentTopic);
|
|||||||
const TestDecoder = createDecoder(TestContentTopic);
|
const TestDecoder = createDecoder(TestContentTopic);
|
||||||
|
|
||||||
describe("Waku Store", () => {
|
describe("Waku Store", () => {
|
||||||
let waku: WakuLight;
|
let waku: LightNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
@ -559,7 +559,7 @@ describe("Waku Store", () => {
|
|||||||
|
|
||||||
describe("Waku Store, custom pubsub topic", () => {
|
describe("Waku Store, custom pubsub topic", () => {
|
||||||
const customPubSubTopic = "/waku/2/custom-dapp/proto";
|
const customPubSubTopic = "/waku/2/custom-dapp/proto";
|
||||||
let waku: WakuLight;
|
let waku: LightNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { waitForRemotePeer } from "@waku/core";
|
import { waitForRemotePeer } from "@waku/core";
|
||||||
import { createLightNode, createPrivacyNode } from "@waku/create";
|
import { createLightNode, createRelayNode } from "@waku/create";
|
||||||
import type { WakuLight, WakuPrivacy } from "@waku/interfaces";
|
import type { LightNode, RelayNode } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { delay, makeLogFileName, NOISE_KEY_1, Nwaku } from "../src/index.js";
|
import { delay, makeLogFileName, NOISE_KEY_1, Nwaku } from "../src/index.js";
|
||||||
|
|
||||||
describe("Wait for remote peer", function () {
|
describe("Wait for remote peer", function () {
|
||||||
let waku1: WakuPrivacy;
|
let waku1: RelayNode;
|
||||||
let waku2: WakuLight;
|
let waku2: LightNode;
|
||||||
let nwaku: Nwaku | undefined;
|
let nwaku: Nwaku | undefined;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
@ -31,7 +31,7 @@ describe("Wait for remote peer", function () {
|
|||||||
});
|
});
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
waku1 = await createPrivacyNode({
|
waku1 = await createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku1.start();
|
await waku1.start();
|
||||||
@ -56,7 +56,7 @@ describe("Wait for remote peer", function () {
|
|||||||
});
|
});
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
waku1 = await createPrivacyNode({
|
waku1 = await createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku1.start();
|
await waku1.start();
|
||||||
@ -75,7 +75,7 @@ describe("Wait for remote peer", function () {
|
|||||||
|
|
||||||
it("Relay - times out", function (done) {
|
it("Relay - times out", function (done) {
|
||||||
this.timeout(5000);
|
this.timeout(5000);
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
})
|
})
|
||||||
.then((waku1) => waku1.start().then(() => waku1))
|
.then((waku1) => waku1.start().then(() => waku1))
|
||||||
@ -253,7 +253,7 @@ describe("Wait for remote peer", function () {
|
|||||||
});
|
});
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
waku1 = await createPrivacyNode({
|
waku1 = await createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku1.start();
|
await waku1.start();
|
||||||
|
@ -6,8 +6,8 @@ import {
|
|||||||
DefaultUserAgent,
|
DefaultUserAgent,
|
||||||
waitForRemotePeer,
|
waitForRemotePeer,
|
||||||
} from "@waku/core";
|
} from "@waku/core";
|
||||||
import { createLightNode, createPrivacyNode } from "@waku/create";
|
import { createLightNode, createRelayNode } from "@waku/create";
|
||||||
import type { Waku, WakuLight, WakuPrivacy } from "@waku/interfaces";
|
import type { LightNode, RelayNode, Waku } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import {
|
import {
|
||||||
createDecoder,
|
createDecoder,
|
||||||
@ -62,7 +62,7 @@ describe("Waku Dial [node only]", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Bootstrap", function () {
|
describe("Bootstrap", function () {
|
||||||
let waku: WakuLight;
|
let waku: LightNode;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
@ -134,15 +134,15 @@ describe("Decryption Keys", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let waku1: WakuPrivacy;
|
let waku1: RelayNode;
|
||||||
let waku2: WakuPrivacy;
|
let waku2: RelayNode;
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(5000);
|
this.timeout(5000);
|
||||||
[waku1, waku2] = await Promise.all([
|
[waku1, waku2] = await Promise.all([
|
||||||
createPrivacyNode({ staticNoiseKey: NOISE_KEY_1 }).then((waku) =>
|
createRelayNode({ staticNoiseKey: NOISE_KEY_1 }).then((waku) =>
|
||||||
waku.start().then(() => waku)
|
waku.start().then(() => waku)
|
||||||
),
|
),
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_2,
|
staticNoiseKey: NOISE_KEY_2,
|
||||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
@ -210,11 +210,11 @@ describe("User Agent", () => {
|
|||||||
const waku1UserAgent = "test-user-agent";
|
const waku1UserAgent = "test-user-agent";
|
||||||
|
|
||||||
[waku1, waku2] = await Promise.all([
|
[waku1, waku2] = await Promise.all([
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
userAgent: waku1UserAgent,
|
userAgent: waku1UserAgent,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
createPrivacyNode({
|
createRelayNode({
|
||||||
staticNoiseKey: NOISE_KEY_2,
|
staticNoiseKey: NOISE_KEY_2,
|
||||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user