2024-01-15 16:12:01 -08:00
|
|
|
import type { PeerId } from "@libp2p/interface";
|
2022-06-20 16:48:30 +10:00
|
|
|
import { peerIdFromString } from "@libp2p/peer-id";
|
|
|
|
|
import { Multiaddr, multiaddr } from "@multiformats/multiaddr";
|
2023-11-16 15:17:17 +03:00
|
|
|
import { DefaultPubsubTopic } from "@waku/interfaces";
|
2023-03-16 12:22:14 +11:00
|
|
|
import { isDefined } from "@waku/utils";
|
2023-10-20 16:36:47 +05:30
|
|
|
import { Logger } from "@waku/utils";
|
2023-09-19 13:21:03 +03:00
|
|
|
import pRetry from "p-retry";
|
2022-02-04 14:12:00 +11:00
|
|
|
import portfinder from "portfinder";
|
2021-03-10 17:39:53 +11:00
|
|
|
|
2023-05-19 01:28:49 +05:30
|
|
|
import {
|
|
|
|
|
Args,
|
|
|
|
|
LogLevel,
|
|
|
|
|
MessageRpcQuery,
|
2024-02-14 18:04:51 -08:00
|
|
|
MessageRpcResponse,
|
|
|
|
|
Ports
|
2024-01-18 00:26:31 +05:30
|
|
|
} from "../types.js";
|
|
|
|
|
import { existsAsync, mkdirAsync, openAsync } from "../utils/async_fs.js";
|
|
|
|
|
import { delay } from "../utils/delay.js";
|
|
|
|
|
import waitForLine from "../utils/log_file.js";
|
|
|
|
|
|
|
|
|
|
import Dockerode from "./dockerode.js";
|
2021-03-10 17:39:53 +11:00
|
|
|
|
2023-10-20 16:36:47 +05:30
|
|
|
const log = new Logger("test:node");
|
2021-04-06 11:00:40 +10:00
|
|
|
|
2022-08-24 07:43:04 +10:00
|
|
|
const WAKU_SERVICE_NODE_PARAMS =
|
|
|
|
|
process.env.WAKU_SERVICE_NODE_PARAMS ?? undefined;
|
2022-05-26 15:49:39 +10:00
|
|
|
const NODE_READY_LOG_LINE = "Node setup complete";
|
2021-03-10 17:39:53 +11:00
|
|
|
|
2024-01-18 17:52:51 +02:00
|
|
|
export const DOCKER_IMAGE_NAME =
|
2024-03-13 20:51:51 +05:30
|
|
|
process.env.WAKUNODE_IMAGE || "wakuorg/nwaku:v0.26.0";
|
2023-04-17 10:29:36 +05:30
|
|
|
|
|
|
|
|
const isGoWaku = DOCKER_IMAGE_NAME.includes("go-waku");
|
|
|
|
|
|
2022-02-04 14:12:00 +11:00
|
|
|
const LOG_DIR = "./log";
|
2021-03-15 13:38:36 +11:00
|
|
|
|
2022-09-11 00:57:10 +10:00
|
|
|
const OneMillion = BigInt(1_000_000);
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
BigInt.prototype.toJSON = function toJSON() {
|
|
|
|
|
return Number(this);
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-18 00:26:31 +05:30
|
|
|
export class ServiceNode {
|
2023-05-19 01:28:49 +05:30
|
|
|
private docker?: Dockerode;
|
2021-03-12 17:08:42 +11:00
|
|
|
private peerId?: PeerId;
|
2021-03-23 11:14:51 +11:00
|
|
|
private multiaddrWithId?: Multiaddr;
|
2023-01-27 15:37:57 +11:00
|
|
|
private websocketPort?: number;
|
2022-02-01 12:54:54 +11:00
|
|
|
private readonly logPath: string;
|
2024-02-14 18:04:51 -08:00
|
|
|
private restPort?: number;
|
2021-03-10 17:39:53 +11:00
|
|
|
|
2022-03-09 12:59:47 +11:00
|
|
|
/**
|
|
|
|
|
* Convert a [[WakuMessage]] to a [[WakuRelayMessage]]. The latter is used
|
|
|
|
|
* by the nwaku JSON-RPC API.
|
|
|
|
|
*/
|
2022-09-11 00:57:10 +10:00
|
|
|
static toMessageRpcQuery(message: {
|
|
|
|
|
payload: Uint8Array;
|
|
|
|
|
contentTopic: string;
|
|
|
|
|
timestamp?: Date;
|
|
|
|
|
}): MessageRpcQuery {
|
2022-03-09 12:59:47 +11:00
|
|
|
if (!message.payload) {
|
|
|
|
|
throw "Attempting to convert empty message";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let timestamp;
|
2022-09-11 00:57:10 +10:00
|
|
|
if (message.timestamp) {
|
|
|
|
|
timestamp = BigInt(message.timestamp.valueOf()) * OneMillion;
|
2022-03-09 12:59:47 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
2023-03-21 12:10:56 +11:00
|
|
|
payload: Buffer.from(message.payload).toString("base64"),
|
2022-03-09 12:59:47 +11:00
|
|
|
contentTopic: message.contentTopic,
|
2023-08-16 20:18:13 +05:30
|
|
|
timestamp
|
2022-03-09 12:59:47 +11:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-25 15:49:07 +11:00
|
|
|
constructor(logName: string) {
|
2023-05-19 01:28:49 +05:30
|
|
|
this.logPath = `${LOG_DIR}/wakunode_${logName}.log`;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-07 01:57:41 +05:30
|
|
|
get type(): "go-waku" | "nwaku" {
|
2023-05-19 01:28:49 +05:30
|
|
|
return isGoWaku ? "go-waku" : "nwaku";
|
2021-03-15 13:25:14 +11:00
|
|
|
}
|
2021-03-11 11:11:37 +11:00
|
|
|
|
2023-05-23 16:06:46 +05:30
|
|
|
get nodeType(): "go-waku" | "nwaku" {
|
|
|
|
|
return isGoWaku ? "go-waku" : "nwaku";
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-13 12:36:43 +03:00
|
|
|
async start(
|
|
|
|
|
args: Args = {},
|
2023-09-19 13:21:03 +03:00
|
|
|
options: {
|
2023-09-29 14:03:43 +03:00
|
|
|
retries?: number;
|
|
|
|
|
} = { retries: 3 }
|
2023-09-19 13:21:03 +03:00
|
|
|
): Promise<void> {
|
|
|
|
|
await pRetry(
|
|
|
|
|
async () => {
|
|
|
|
|
try {
|
2023-10-13 12:36:43 +03:00
|
|
|
this.docker = await Dockerode.createInstance(DOCKER_IMAGE_NAME);
|
|
|
|
|
try {
|
|
|
|
|
await existsAsync(LOG_DIR);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
try {
|
|
|
|
|
await mkdirAsync(LOG_DIR);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// Looks like 2 tests tried to create the director at the same time,
|
|
|
|
|
// it can be ignored
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await openAsync(this.logPath, "w");
|
|
|
|
|
|
|
|
|
|
const mergedArgs = defaultArgs();
|
|
|
|
|
|
|
|
|
|
// waku nodes takes some time to bind port so to decrease chances of conflict
|
|
|
|
|
// we also randomize the first port that portfinder will try
|
2024-03-10 00:40:33 +02:00
|
|
|
// depending on getPorts count adjust the random function in such a way that max port is 65535
|
|
|
|
|
const startPort = Math.floor(Math.random() * (65530 - 1025) + 1025);
|
2023-10-13 12:36:43 +03:00
|
|
|
|
2024-02-14 18:04:51 -08:00
|
|
|
const ports: Ports = await new Promise((resolve, reject) => {
|
2024-03-01 13:58:19 -08:00
|
|
|
portfinder.getPorts(4, { port: startPort }, (err, ports) => {
|
2023-10-13 12:36:43 +03:00
|
|
|
if (err) reject(err);
|
2024-02-14 18:04:51 -08:00
|
|
|
resolve({
|
2024-03-01 13:58:19 -08:00
|
|
|
tcpPort: ports[0],
|
|
|
|
|
websocketPort: ports[1],
|
|
|
|
|
restPort: ports[2],
|
|
|
|
|
discv5UdpPort: ports[3]
|
2024-02-14 18:04:51 -08:00
|
|
|
});
|
2023-10-13 12:36:43 +03:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (isGoWaku && !args.logLevel) {
|
|
|
|
|
args.logLevel = LogLevel.Debug;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-01 13:58:19 -08:00
|
|
|
const { tcpPort, websocketPort, restPort, discv5UdpPort } = ports;
|
2024-02-14 18:04:51 -08:00
|
|
|
this.restPort = restPort;
|
2023-10-13 12:36:43 +03:00
|
|
|
this.websocketPort = websocketPort;
|
|
|
|
|
|
|
|
|
|
// `legacyFilter` is required to enable filter v1 with go-waku
|
|
|
|
|
const { legacyFilter = false, ..._args } = args;
|
|
|
|
|
|
|
|
|
|
// Object.assign overrides the properties with the source (if there are conflicts)
|
|
|
|
|
Object.assign(
|
|
|
|
|
mergedArgs,
|
|
|
|
|
{
|
2024-02-14 18:04:51 -08:00
|
|
|
rest: true,
|
|
|
|
|
restPort,
|
2023-10-13 12:36:43 +03:00
|
|
|
tcpPort,
|
|
|
|
|
websocketPort,
|
|
|
|
|
...(args?.peerExchange && { discv5UdpPort }),
|
|
|
|
|
...(isGoWaku && { minRelayPeersToPublish: 0, legacyFilter })
|
|
|
|
|
},
|
2024-03-01 13:58:19 -08:00
|
|
|
{ restAddress: "0.0.0.0" },
|
2023-10-13 12:36:43 +03:00
|
|
|
_args
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
process.env.WAKUNODE2_STORE_MESSAGE_DB_URL = "";
|
|
|
|
|
|
|
|
|
|
if (this.docker.container) {
|
|
|
|
|
await this.docker.stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await this.docker?.startContainer(
|
|
|
|
|
ports,
|
|
|
|
|
mergedArgs,
|
|
|
|
|
this.logPath,
|
|
|
|
|
WAKU_SERVICE_NODE_PARAMS
|
|
|
|
|
);
|
2023-09-19 13:21:03 +03:00
|
|
|
} catch (error) {
|
2023-10-20 16:36:47 +05:30
|
|
|
log.error("Nwaku node failed to start:", error);
|
2023-10-13 12:36:43 +03:00
|
|
|
await this.stop();
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
try {
|
2023-10-20 16:36:47 +05:30
|
|
|
log.info(
|
|
|
|
|
`Waiting to see '${NODE_READY_LOG_LINE}' in ${this.type} logs`
|
|
|
|
|
);
|
2023-10-13 12:36:43 +03:00
|
|
|
await this.waitForLog(NODE_READY_LOG_LINE, 15000);
|
|
|
|
|
if (process.env.CI) await delay(100);
|
2023-10-20 16:36:47 +05:30
|
|
|
log.info(`${this.type} node has been started`);
|
2023-10-13 12:36:43 +03:00
|
|
|
} catch (error) {
|
2023-10-20 16:36:47 +05:30
|
|
|
log.error(`Error starting ${this.type}: ${error}`);
|
2023-10-13 12:36:43 +03:00
|
|
|
if (this.docker.container) await this.docker.stop();
|
2023-09-19 13:21:03 +03:00
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ retries: options.retries }
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-17 10:29:36 +05:30
|
|
|
public async stop(): Promise<void> {
|
2023-10-13 12:36:43 +03:00
|
|
|
await this.docker?.stop();
|
2023-07-24 16:04:24 +05:30
|
|
|
delete this.docker;
|
2021-03-19 16:07:56 +11:00
|
|
|
}
|
|
|
|
|
|
2021-08-09 11:58:58 +10:00
|
|
|
async waitForLog(msg: string, timeout: number): Promise<void> {
|
|
|
|
|
return waitForLine(this.logPath, msg, timeout);
|
2021-03-10 17:39:53 +11:00
|
|
|
}
|
|
|
|
|
|
2024-03-04 10:56:20 +01:00
|
|
|
/**
|
|
|
|
|
* Calls nwaku REST API "/admin/v1/peers" to check for known peers
|
|
|
|
|
* @throws
|
2021-03-10 17:39:53 +11:00
|
|
|
*/
|
2021-05-03 15:52:38 +10:00
|
|
|
async peers(): Promise<string[]> {
|
2021-03-10 17:39:53 +11:00
|
|
|
this.checkProcess();
|
|
|
|
|
|
2024-02-15 17:53:51 -08:00
|
|
|
return this.restCall<string[]>(
|
|
|
|
|
"/admin/v1/peers",
|
|
|
|
|
"GET",
|
|
|
|
|
undefined,
|
|
|
|
|
async (response) => {
|
|
|
|
|
const data = await response.json();
|
|
|
|
|
return data?.length ? data : [];
|
|
|
|
|
}
|
|
|
|
|
);
|
2021-03-10 17:39:53 +11:00
|
|
|
}
|
|
|
|
|
|
2021-03-12 17:08:42 +11:00
|
|
|
async info(): Promise<RpcInfoResponse> {
|
2021-03-10 17:39:53 +11:00
|
|
|
this.checkProcess();
|
|
|
|
|
|
2024-02-15 17:53:51 -08:00
|
|
|
return this.restCall<RpcInfoResponse>(
|
|
|
|
|
"/debug/v1/info",
|
|
|
|
|
"GET",
|
|
|
|
|
undefined,
|
|
|
|
|
async (response) => await response.json()
|
|
|
|
|
);
|
2021-03-10 17:39:53 +11:00
|
|
|
}
|
|
|
|
|
|
2023-09-19 16:45:27 -04:00
|
|
|
async ensureSubscriptions(
|
2023-11-14 21:22:52 +05:30
|
|
|
pubsubTopics: string[] = [DefaultPubsubTopic]
|
2023-09-19 16:45:27 -04:00
|
|
|
): Promise<boolean> {
|
2024-02-14 18:04:51 -08:00
|
|
|
return this.restCall<boolean>(
|
|
|
|
|
"/relay/v1/subscriptions",
|
|
|
|
|
"POST",
|
|
|
|
|
pubsubTopics,
|
|
|
|
|
async (response) => response.status === 200
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-09-19 16:45:27 -04:00
|
|
|
|
2024-02-14 18:04:51 -08:00
|
|
|
async messages(
|
|
|
|
|
pubsubTopic: string = DefaultPubsubTopic
|
|
|
|
|
): Promise<MessageRpcResponse[]> {
|
|
|
|
|
return this.restCall<MessageRpcResponse[]>(
|
2024-02-15 17:53:51 -08:00
|
|
|
`/relay/v1/messages/${encodeURIComponent(pubsubTopic)}`,
|
2024-02-14 18:04:51 -08:00
|
|
|
"GET",
|
|
|
|
|
null,
|
|
|
|
|
async (response) => {
|
|
|
|
|
const data = await response.json();
|
|
|
|
|
return data?.length ? data : [];
|
|
|
|
|
}
|
|
|
|
|
);
|
2023-09-19 16:45:27 -04:00
|
|
|
}
|
|
|
|
|
|
2023-11-16 15:17:17 +03:00
|
|
|
async ensureSubscriptionsAutosharding(
|
|
|
|
|
contentTopics: string[]
|
|
|
|
|
): Promise<boolean> {
|
|
|
|
|
this.checkProcess();
|
|
|
|
|
|
2024-02-14 18:04:51 -08:00
|
|
|
return this.restCall<boolean>(
|
|
|
|
|
"/relay/v1/subscriptions",
|
|
|
|
|
"POST",
|
|
|
|
|
contentTopics,
|
|
|
|
|
async (response) => response.status === 200
|
|
|
|
|
);
|
2023-11-16 15:17:17 +03:00
|
|
|
}
|
|
|
|
|
|
2021-06-09 12:25:56 +10:00
|
|
|
async sendMessage(
|
2022-09-11 00:57:10 +10:00
|
|
|
message: MessageRpcQuery,
|
2023-11-14 21:22:52 +05:30
|
|
|
pubsubTopic: string = DefaultPubsubTopic
|
2021-06-09 12:25:56 +10:00
|
|
|
): Promise<boolean> {
|
2021-03-12 10:35:50 +11:00
|
|
|
this.checkProcess();
|
|
|
|
|
|
2022-09-11 00:57:10 +10:00
|
|
|
if (typeof message.timestamp === "undefined") {
|
|
|
|
|
message.timestamp = BigInt(new Date().valueOf()) * OneMillion;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-15 17:53:51 -08:00
|
|
|
return this.restCall<boolean>(
|
|
|
|
|
`/relay/v1/messages/${encodeURIComponent(pubsubTopic)}`,
|
|
|
|
|
"POST",
|
|
|
|
|
message,
|
|
|
|
|
async (response) => response.status === 200
|
|
|
|
|
);
|
2021-03-12 10:35:50 +11:00
|
|
|
}
|
|
|
|
|
|
2023-11-16 15:17:17 +03:00
|
|
|
async sendMessageAutosharding(message: MessageRpcQuery): Promise<boolean> {
|
|
|
|
|
this.checkProcess();
|
|
|
|
|
|
|
|
|
|
if (typeof message.timestamp === "undefined") {
|
|
|
|
|
message.timestamp = BigInt(new Date().valueOf()) * OneMillion;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-15 17:53:51 -08:00
|
|
|
return this.restCall<boolean>(
|
|
|
|
|
`/relay/v1/auto/message`,
|
|
|
|
|
"POST",
|
|
|
|
|
message,
|
|
|
|
|
async (response) => response.status === 200
|
|
|
|
|
);
|
2023-11-16 15:17:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async messagesAutosharding(
|
|
|
|
|
contentTopic: string
|
|
|
|
|
): Promise<MessageRpcResponse[]> {
|
|
|
|
|
this.checkProcess();
|
|
|
|
|
|
2024-02-14 18:04:51 -08:00
|
|
|
return this.restCall<MessageRpcResponse[]>(
|
2024-02-15 17:53:51 -08:00
|
|
|
`/relay/v1/auto/messages/${encodeURIComponent(contentTopic)}`,
|
2024-02-14 18:04:51 -08:00
|
|
|
"GET",
|
|
|
|
|
null,
|
|
|
|
|
async (response) => {
|
|
|
|
|
const data = await response.json();
|
|
|
|
|
return data?.length ? data.filter(isDefined) : [];
|
|
|
|
|
}
|
2023-11-16 15:17:17 +03:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-12 17:08:42 +11:00
|
|
|
async getPeerId(): Promise<PeerId> {
|
2023-01-27 15:37:57 +11:00
|
|
|
if (this.peerId) return this.peerId;
|
|
|
|
|
this.peerId = await this._getPeerId();
|
|
|
|
|
return this.peerId;
|
2021-03-23 11:14:51 +11:00
|
|
|
}
|
2021-03-12 17:08:42 +11:00
|
|
|
|
2021-03-23 11:14:51 +11:00
|
|
|
async getMultiaddrWithId(): Promise<Multiaddr> {
|
2023-01-27 15:37:57 +11:00
|
|
|
if (this.multiaddrWithId) return this.multiaddrWithId;
|
|
|
|
|
|
|
|
|
|
const peerId = await this.getPeerId();
|
|
|
|
|
|
|
|
|
|
this.multiaddrWithId = multiaddr(
|
2023-08-16 20:18:13 +05:30
|
|
|
`/ip4/127.0.0.1/tcp/${this.websocketPort}/ws/p2p/${peerId.toString()}`
|
2023-01-27 15:37:57 +11:00
|
|
|
);
|
|
|
|
|
return this.multiaddrWithId;
|
2021-03-23 11:14:51 +11:00
|
|
|
}
|
2021-03-12 17:08:42 +11:00
|
|
|
|
2023-01-27 15:37:57 +11:00
|
|
|
private async _getPeerId(): Promise<PeerId> {
|
|
|
|
|
if (this.peerId) {
|
|
|
|
|
return this.peerId;
|
2021-03-23 11:14:51 +11:00
|
|
|
}
|
|
|
|
|
const res = await this.info();
|
2023-01-27 15:37:57 +11:00
|
|
|
const multiaddrWithId = res.listenAddresses
|
2022-01-20 13:00:58 +11:00
|
|
|
.map((ma) => multiaddr(ma))
|
2022-02-04 14:12:00 +11:00
|
|
|
.find((ma) => ma.protoNames().includes("ws"));
|
2023-05-19 01:28:49 +05:30
|
|
|
if (!multiaddrWithId) throw `${this.type} did not return a ws multiaddr`;
|
2023-01-27 15:37:57 +11:00
|
|
|
const peerIdStr = multiaddrWithId.getPeerId();
|
2023-05-19 01:28:49 +05:30
|
|
|
if (!peerIdStr) throw `${this.type} multiaddr does not contain peerId`;
|
2022-06-20 16:48:30 +10:00
|
|
|
this.peerId = peerIdFromString(peerIdStr);
|
2023-01-27 15:37:57 +11:00
|
|
|
|
|
|
|
|
return this.peerId;
|
2021-03-10 17:39:53 +11:00
|
|
|
}
|
|
|
|
|
|
2024-02-14 18:04:51 -08:00
|
|
|
get httpUrl(): string {
|
|
|
|
|
return `http://127.0.0.1:${this.restPort}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async restCall<T>(
|
|
|
|
|
endpoint: string,
|
|
|
|
|
method: "GET" | "POST",
|
|
|
|
|
body: any = null,
|
|
|
|
|
processResponse: (response: Response) => Promise<T>
|
|
|
|
|
): Promise<T> {
|
|
|
|
|
this.checkProcess();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
log.info("Making a REST Call: ", endpoint, body);
|
|
|
|
|
const options: RequestInit = {
|
|
|
|
|
method,
|
|
|
|
|
headers: new Headers({ "Content-Type": "application/json" })
|
|
|
|
|
};
|
|
|
|
|
if (body) options.body = JSON.stringify(body);
|
|
|
|
|
|
|
|
|
|
const response = await fetch(`${this.httpUrl}${endpoint}`, options);
|
|
|
|
|
log.info(`Received REST Response: `, response.status);
|
|
|
|
|
return await processResponse(response);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
log.error(`${this.httpUrl} failed with error:`, error);
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-03 15:52:38 +10:00
|
|
|
private checkProcess(): void {
|
2023-05-19 01:28:49 +05:30
|
|
|
if (!this.docker?.container) {
|
|
|
|
|
throw `${this.type} container hasn't started`;
|
2021-03-10 17:39:53 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-11 10:54:35 +11:00
|
|
|
|
2021-03-12 17:08:42 +11:00
|
|
|
export function defaultArgs(): Args {
|
2021-03-11 10:54:35 +11:00
|
|
|
return {
|
2023-04-17 10:29:36 +05:30
|
|
|
listenAddress: "0.0.0.0",
|
2022-12-12 11:08:08 +05:30
|
|
|
relay: false,
|
2024-02-14 18:04:51 -08:00
|
|
|
rest: true,
|
2024-02-15 17:53:51 -08:00
|
|
|
restAdmin: true,
|
2022-01-20 13:00:58 +11:00
|
|
|
websocketSupport: true,
|
2023-08-16 20:18:13 +05:30
|
|
|
logLevel: LogLevel.Trace
|
2021-03-11 10:54:35 +11:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-12 17:08:42 +11:00
|
|
|
interface RpcInfoResponse {
|
2022-01-19 15:43:45 +11:00
|
|
|
// multiaddrs including peer id.
|
|
|
|
|
listenAddresses: string[];
|
2022-05-04 20:07:21 +10:00
|
|
|
enrUri?: string;
|
2021-03-12 17:08:42 +11:00
|
|
|
}
|