Compare commits
19 Commits
69e613075e
...
c1e474e025
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | c1e474e025 | |
Derrick Hammer | 0ebd876c67 | |
Derrick Hammer | c7e0e23950 | |
Derrick Hammer | b6a6bdc97f | |
Derrick Hammer | d06575e9ee | |
Derrick Hammer | ddc93ba71e | |
Derrick Hammer | 7ec8bb79db | |
Derrick Hammer | 1bd466cc20 | |
Derrick Hammer | 2e3fe286f9 | |
Derrick Hammer | 3facaddae8 | |
Derrick Hammer | abafc1c715 | |
Derrick Hammer | 6621f25b5e | |
Derrick Hammer | 6d2cffd869 | |
Derrick Hammer | b3fb59d283 | |
Derrick Hammer | c7f0dd586d | |
Derrick Hammer | c6d4ea5a8e | |
Derrick Hammer | c25bf102fe | |
Derrick Hammer | 79f981d789 | |
Derrick Hammer | 0736469296 |
|
@ -0,0 +1,32 @@
|
||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- "develop-*"
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set Repo Origin
|
||||||
|
run: git remote set origin https://git.lumeweb.com/LumeWeb/relay.git
|
||||||
|
- uses: webfactory/ssh-agent@v0.7.0
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.GITEA_SSH_KEY }}
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: "lts/*"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
- name: Release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
run: npx semantic-release
|
|
@ -0,0 +1,4 @@
|
||||||
|
public-hoist-pattern[]=udx-native
|
||||||
|
public-hoist-pattern[]=sodium-native
|
||||||
|
public-hoist-pattern[]=@hyperswarm/dht
|
||||||
|
public-hoist-pattern[]=hypercore-crypto
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"@semantic-release/commit-analyzer",
|
||||||
|
"@semantic-release/release-notes-generator",
|
||||||
|
"@semantic-release/changelog",
|
||||||
|
[
|
||||||
|
"@semantic-release/npm",
|
||||||
|
{
|
||||||
|
"npmPublish": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@semantic-release/git",
|
||||||
|
{
|
||||||
|
"assets": [
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"branches": [
|
||||||
|
"master",
|
||||||
|
{
|
||||||
|
name: "develop",
|
||||||
|
prerelease: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "develop-*",
|
||||||
|
prerelease: true
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,49 +0,0 @@
|
||||||
pipeline:
|
|
||||||
build:
|
|
||||||
image: git.lumeweb.com/lumeweb/ci-node
|
|
||||||
commands:
|
|
||||||
- corepack enable
|
|
||||||
- corepack prepare yarn@stable --activate
|
|
||||||
- yarn
|
|
||||||
- yarn build
|
|
||||||
package:
|
|
||||||
image: ghcr.io/goreleaser/nfpm
|
|
||||||
commands:
|
|
||||||
- nfpm pkg --packager deb
|
|
||||||
publish_focal:
|
|
||||||
image: git.lumeweb.com/lumeweb/aptly-publisher
|
|
||||||
settings:
|
|
||||||
apt_username:
|
|
||||||
from_secret: APT_USERNAME
|
|
||||||
apt_password:
|
|
||||||
from_secret: APT_PASSWORD
|
|
||||||
repo: apt.web3relay.io
|
|
||||||
folder: ubuntu
|
|
||||||
distro: focal
|
|
||||||
gpg_password:
|
|
||||||
from_secret: GPG_PASSWORD
|
|
||||||
publish_jammy:
|
|
||||||
image: git.lumeweb.com/lumeweb/aptly-publisher
|
|
||||||
settings:
|
|
||||||
apt_username:
|
|
||||||
from_secret: APT_USERNAME
|
|
||||||
apt_password:
|
|
||||||
from_secret: APT_PASSWORD
|
|
||||||
repo: apt.web3relay.io
|
|
||||||
folder: ubuntu
|
|
||||||
distro: jammy
|
|
||||||
gpg_password:
|
|
||||||
from_secret: GPG_PASSWORD
|
|
||||||
purge_do_cdn:
|
|
||||||
image: git.lumeweb.com/lumeweb/do-cdn-purge
|
|
||||||
settings:
|
|
||||||
DIGITALOCEAN_ACCESS_TOKEN:
|
|
||||||
from_secret: digitalocean_access_token
|
|
||||||
DIGITALOCEAN_CDN_ID:
|
|
||||||
from_secret: digitalocean_cdn_id
|
|
||||||
purge_cf_cdn:
|
|
||||||
image: git.lumeweb.com/lumeweb/cf-cdn-purge
|
|
||||||
settings:
|
|
||||||
CLOUDFLARE_ACCESS_TOKEN:
|
|
||||||
from_secret: cloudflare_access_token
|
|
||||||
DOMAIN: web3relay.io
|
|
|
@ -1,18 +0,0 @@
|
||||||
diff --git a/index.js b/index.js
|
|
||||||
index dc628dab1a201e6679a1716b3d51b56e4723b49d..9daeb44298586d51d7bb6e859a1dd696846e0078 100644
|
|
||||||
--- a/index.js
|
|
||||||
+++ b/index.js
|
|
||||||
@@ -115,11 +115,11 @@ class HDKey {
|
|
||||||
});
|
|
||||||
}
|
|
||||||
sign(message) {
|
|
||||||
- message = ensureBytes(message, 32);
|
|
||||||
+ message = ensureBytes(message);
|
|
||||||
return ed25519.sync.sign(message, this.privateKey);
|
|
||||||
}
|
|
||||||
verify(message, signature) {
|
|
||||||
- message = ensureBytes(message, 32);
|
|
||||||
+ message = ensureBytes(message);
|
|
||||||
signature = ensureBytes(signature, 64);
|
|
||||||
return ed25519.sync.verify(signature, message, this.publicKeyRaw);
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
nodeLinker: node-modules
|
|
File diff suppressed because it is too large
Load Diff
93
package.json
93
package.json
|
@ -1,79 +1,70 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/relay",
|
"name": "@lumeweb/relay",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"version": "0.1.0",
|
"version": "0.0.0-development",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"types": "src/types.ts",
|
"repository": {
|
||||||
|
"url": "https://git.lumeweb.com/LumeWeb/relay.git"
|
||||||
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Derrick Hammer",
|
"name": "Derrick Hammer",
|
||||||
"email": "contact@lumeweb.com"
|
"email": "contact@lumeweb.com"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "yarn tsc",
|
"semantic-release": "semantic-release",
|
||||||
|
"compile": "npm run tsc",
|
||||||
"prebuild": "bash prebuild.sh",
|
"prebuild": "bash prebuild.sh",
|
||||||
"package": "yarn pkg -c pkg.json build/index.js -t linux --public --no-native-build -C gzip",
|
"package": "pkg -c pkg.json build/index.js -t linux --public --no-native-build -C gzip",
|
||||||
"package-debug": "yarn pkg -c pkg.json build/index.js -b -t linux --no-bytecode --public",
|
"build": "npm run compile && npm run prebuild && npm run package"
|
||||||
"build": "yarn run compile && npm run prebuild && npm run package",
|
|
||||||
"barebuild": "yarn run compile && npm run package"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/websocket": "^7.1.1",
|
"@fastify/websocket": "^7.2.0",
|
||||||
"@hyperswarm/dht-relay": "^0.3.0",
|
"@hyperswarm/dht-relay": "^0.4.0",
|
||||||
"@lumeweb/cfg": "https://git.lumeweb.com/LumeWeb/cfg.git",
|
"@lumeweb/cfg": "git+https://git.lumeweb.com/LumeWeb/cfg.git",
|
||||||
"@lumeweb/dht-cache": "https://git.lumeweb.com/LumeWeb/dht-cache.git",
|
"@lumeweb/interface-relay": "git+https://git.lumeweb.com/LumeWeb/interface-relay",
|
||||||
"@scure/bip39": "^1.1.0",
|
"@scure/bip39": "^1.2.0",
|
||||||
"@types/acme-client": "^3.3.0",
|
"@types/node": "^18.15.11",
|
||||||
"@types/node": "^18.0.0",
|
"@types/ws": "^8.5.4",
|
||||||
"@types/node-cron": "^3.0.2",
|
|
||||||
"@types/ws": "^8.5.3",
|
|
||||||
"ajv": "^8.11.0",
|
|
||||||
"async-mutex": "^0.3.2",
|
"async-mutex": "^0.3.2",
|
||||||
"b4a": "^1.6.1",
|
"b4a": "^1.6.3",
|
||||||
"compact-encoding": "^2.11.0",
|
"compact-encoding": "^2.11.0",
|
||||||
"date-fns": "^2.28.0",
|
"dotenv": "^16.0.3",
|
||||||
"dotenv": "^16.0.1",
|
"ed25519-keygen": "github:LumeWeb/ed25519-keygen",
|
||||||
"ethers": "^5.6.9",
|
"ethers": "^5.7.2",
|
||||||
"eventemitter2": "^6.4.9",
|
"eventemitter2": "^6.4.9",
|
||||||
"fastify": "^4.10.2",
|
"fastify": "^4.15.0",
|
||||||
"fetch-blob": "https://github.com/LumeWeb/fetch-blob.git",
|
"fetch-blob": "github:LumeWeb/fetch-blob",
|
||||||
"hyperswarm": "^4.3.5",
|
"hyperswarm": "^4.4.0",
|
||||||
"json-stable-stringify": "^1.0.1",
|
"json-stable-stringify": "^1.0.2",
|
||||||
"json-stringify-deterministic": "^1.0.7",
|
"json-stringify-deterministic": "^1.0.8",
|
||||||
"loady": "https://github.com/LumeWeb/loady.git",
|
"loady": "github:LumeWeb/loady",
|
||||||
"micro-ed25519-hdkey": "patch:micro-ed25519-hdkey@npm%3A0.1.2#~/.yarn/patches/micro-ed25519-hdkey-npm-0.1.2-5d1d767d1d.patch",
|
"msgpackr": "^1.8.5",
|
||||||
"msgpackr": "^1.6.1",
|
|
||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"node-cron": "^3.0.1",
|
"node-fetch": "^2.6.9",
|
||||||
"node-fetch": "2",
|
"p-timeout": "git+https://git.lumeweb.com/LumeWeb/p-timeout.git",
|
||||||
"p-timeout": "https://git.lumeweb.com/LumeWeb/p-timeout.git",
|
"pino": "^8.11.0",
|
||||||
"pino": "^8.8.0",
|
"pino-pretty": "^9.4.0",
|
||||||
"pino-pretty": "^9.1.1",
|
|
||||||
"promise-retry": "^2.0.1",
|
"promise-retry": "^2.0.1",
|
||||||
"protomux": "^3.4.0",
|
"protomux": "^3.4.1",
|
||||||
"protomux-rpc": "^1.3.0",
|
"protomux-rpc": "^1.3.0",
|
||||||
"random-access-memory": "^4.1.0",
|
|
||||||
"random-key": "^0.3.2",
|
"random-key": "^0.3.2",
|
||||||
"slugify": "^1.6.5",
|
"slugify": "^1.6.6",
|
||||||
"sodium-universal": "^3.1.0"
|
"sodium-universal": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@lumeweb/relay-types": "https://git.lumeweb.com/LumeWeb/relay-types.git",
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
"@types/b4a": "^1.6.0",
|
"@types/b4a": "^1.6.0",
|
||||||
"@types/minimatch": "^3.0.5",
|
"@types/minimatch": "^3.0.5",
|
||||||
"@types/node-fetch": "^2.6.2",
|
"@types/node-fetch": "^2.6.3",
|
||||||
"cli-progress": "^3.11.2",
|
"cli-progress": "^3.12.0",
|
||||||
"hyper-typings": "^1.0.0",
|
"hyper-typings": "^1.0.0",
|
||||||
"node-gyp": "^9.1.0",
|
"node-gyp": "^9.3.1",
|
||||||
"pkg": "^5.8.0",
|
"pkg": "^5.8.1",
|
||||||
"prebuildify": "^5.0.1",
|
"prebuildify": "^5.0.1",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.8.7",
|
||||||
"rollup": "^2.77.0",
|
"semantic-release": "21",
|
||||||
"supports-color": "https://github.com/LumeWeb/supports-color.git",
|
"supports-color": "github:LumeWeb/supports-color",
|
||||||
"typescript": "^4.9.4"
|
"typescript": "^4.9.5"
|
||||||
},
|
|
||||||
"packageManager": "yarn@4.0.0-rc.33",
|
|
||||||
"resolutions": {
|
|
||||||
"micro-ed25519-hdkey@npm:^0.1.2": "patch:micro-ed25519-hdkey@npm%3A0.1.2#~/.yarn/patches/micro-ed25519-hdkey-npm-0.1.2-5d1d767d1d.patch"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
pkg.json
4
pkg.json
|
@ -1,9 +1,5 @@
|
||||||
{
|
{
|
||||||
"assets": [
|
"assets": [
|
||||||
"node_modules/*/build/Release/*.node",
|
|
||||||
"node_modules/libskynet",
|
|
||||||
"node_modules/libskynetnode",
|
|
||||||
"node_modules/@lumeweb"
|
|
||||||
],
|
],
|
||||||
"outputPath": "dist"
|
"outputPath": "dist"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import * as fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import log from "./log.js";
|
import log from "./log.js";
|
||||||
|
|
||||||
const config = new Config("lumeweb-relay", "core.confdir");
|
const config = new Config("lumeweb-relay", "core.confDir");
|
||||||
|
|
||||||
let configDir;
|
let configDir;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ config.inject({
|
||||||
|
|
||||||
config.load();
|
config.load();
|
||||||
|
|
||||||
configDir = config.str("core.confdir");
|
configDir = config.str("core.confDir");
|
||||||
|
|
||||||
if (fs.existsSync(configDir)) {
|
if (fs.existsSync(configDir)) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { HDKey } from "micro-ed25519-hdkey";
|
import { HDKey } from "ed25519-keygen/dist/hdkey";
|
||||||
import config from "../config";
|
import config from "../config";
|
||||||
import * as bip39 from "@scure/bip39";
|
import * as bip39 from "@scure/bip39";
|
||||||
import { wordlist } from "@scure/bip39/wordlists/english";
|
import { wordlist } from "@scure/bip39/wordlists/english";
|
||||||
|
|
|
@ -20,7 +20,7 @@ export async function start() {
|
||||||
|
|
||||||
await getPluginAPI().emitAsync("core.appServer.buildRoutes");
|
await getPluginAPI().emitAsync("core.appServer.buildRoutes");
|
||||||
|
|
||||||
await app.listen({ port: config.uint("core.appport"), host: "0.0.0.0" });
|
await app.listen({ port: config.uint("core.appPort"), host: "0.0.0.0" });
|
||||||
|
|
||||||
getPluginAPI().emit("core.appServer.started");
|
getPluginAPI().emit("core.appServer.started");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import config from "../config.js";
|
import config from "../config.js";
|
||||||
import type { RPCServer } from "./rpc/server.js";
|
import type { RPCServer } from "./rpc/server.js";
|
||||||
import { getRpcServer } from "./rpc/server.js";
|
import { getRpcServer } from "./rpc/server.js";
|
||||||
import type { Plugin, RPCMethod } from "@lumeweb/relay-types";
|
import type { Plugin, RPCMethod } from "@lumeweb/interface-relay";
|
||||||
import slugify from "slugify";
|
import slugify from "slugify";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
@ -17,7 +17,7 @@ import {
|
||||||
ProtocolManager,
|
ProtocolManager,
|
||||||
} from "./swarm.js";
|
} from "./swarm.js";
|
||||||
import { get as getApp } from "./app.js";
|
import { get as getApp } from "./app.js";
|
||||||
import type { HDKey } from "micro-ed25519-hdkey";
|
import type { HDKey } from "ed25519-keygen/dist/hdkey";
|
||||||
import corePlugins from "../plugins";
|
import corePlugins from "../plugins";
|
||||||
import Util from "./plugin/util";
|
import Util from "./plugin/util";
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {
|
||||||
RPCMethod,
|
RPCMethod,
|
||||||
RPCRequest,
|
RPCRequest,
|
||||||
RPCResponse,
|
RPCResponse,
|
||||||
} from "@lumeweb/relay-types";
|
} from "@lumeweb/interface-relay";
|
||||||
import EventEmitter from "events";
|
import EventEmitter from "events";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import ProtomuxRPC from "protomux-rpc";
|
import ProtomuxRPC from "protomux-rpc";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Plugin, PluginAPI } from "@lumeweb/relay-types";
|
import { Plugin, PluginAPI } from "@lumeweb/interface-relay";
|
||||||
|
|
||||||
const plugin: Plugin = {
|
const plugin: Plugin = {
|
||||||
name: "core",
|
name: "core",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Plugin, PluginAPI } from "@lumeweb/relay-types";
|
import { Plugin, PluginAPI } from "@lumeweb/interface-relay";
|
||||||
import b4a from "b4a";
|
import b4a from "b4a";
|
||||||
|
|
||||||
const plugin: Plugin = {
|
const plugin: Plugin = {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {
|
||||||
RPCCacheItem,
|
RPCCacheItem,
|
||||||
RPCRequest,
|
RPCRequest,
|
||||||
RPCResponse,
|
RPCResponse,
|
||||||
} from "@lumeweb/relay-types";
|
} from "@lumeweb/interface-relay";
|
||||||
import { getRpcByPeer } from "../modules/rpc";
|
import { getRpcByPeer } from "../modules/rpc";
|
||||||
import { get as getSwarm, LUMEWEB_TOPIC_HASH } from "../modules/swarm";
|
import { get as getSwarm, LUMEWEB_TOPIC_HASH } from "../modules/swarm";
|
||||||
import b4a from "b4a";
|
import b4a from "b4a";
|
||||||
|
@ -50,91 +50,6 @@ const plugin: Plugin = {
|
||||||
name: "rpc",
|
name: "rpc",
|
||||||
async plugin(_api: PluginAPI): Promise<void> {
|
async plugin(_api: PluginAPI): Promise<void> {
|
||||||
api = _api;
|
api = _api;
|
||||||
if (api.config.bool("cache")) {
|
|
||||||
api.registerMethod("get_cached_item", {
|
|
||||||
cacheable: false,
|
|
||||||
async handler(req: string): Promise<RPCResponse> {
|
|
||||||
if (typeof req !== "string") {
|
|
||||||
throw new Error("item must be a string");
|
|
||||||
}
|
|
||||||
|
|
||||||
const cache = api.rpcServer.cache?.data;
|
|
||||||
|
|
||||||
if (!cache?.has(req)) {
|
|
||||||
throw new Error("item does not exist");
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
data: true,
|
|
||||||
...cache.get<RPCCacheItem>(req)?.value,
|
|
||||||
signature: cache.get<RPCCacheItem>(req)?.signature,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
api.registerMethod("clear_cached_item", {
|
|
||||||
cacheable: false,
|
|
||||||
async handler(req: string): Promise<void> {
|
|
||||||
if (typeof req !== "string") {
|
|
||||||
throw new Error("item must be a string");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
api.rpcServer.cache.deleteItem(req);
|
|
||||||
} catch (e: any) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
api.registerMethod("get_peers", {
|
|
||||||
cacheable: false,
|
|
||||||
async handler(): Promise<string[]> {
|
|
||||||
const pubkey = b4a.from(api.identity.publicKeyRaw).toString("hex");
|
|
||||||
|
|
||||||
const online = api.rpcServer.cache?.dhtCache.online || new Set();
|
|
||||||
if (online.has(pubkey)) {
|
|
||||||
online.delete(pubkey);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [...online];
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (api.logger.level === "debug") {
|
|
||||||
api.registerMethod("get_direct_peers", {
|
|
||||||
cacheable: false,
|
|
||||||
async handler(): Promise<string[]> {
|
|
||||||
const online = api.rpcServer.cache.dhtCache.online;
|
|
||||||
const pubkey = b4a
|
|
||||||
.from(api.swarm.keyPair.publicKeyRaw())
|
|
||||||
.toString("hex");
|
|
||||||
|
|
||||||
if (online.has(pubkey)) {
|
|
||||||
online.delete(pubkey);
|
|
||||||
}
|
|
||||||
|
|
||||||
const topic = LUMEWEB_TOPIC_HASH.toString("hex");
|
|
||||||
return [...api.swarm.peers.values()]
|
|
||||||
.filter((item: any) =>
|
|
||||||
[...item._seenTopics.keys()].includes(topic)
|
|
||||||
)
|
|
||||||
.map((item: any) => item.publicKey.toString("hex"))
|
|
||||||
.filter((item: any) => online.has(item));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
api.registerMethod("get_bootstrap_info", {
|
|
||||||
cacheable: false,
|
|
||||||
async handler(): Promise<string[]> {
|
|
||||||
// @ts-ignore
|
|
||||||
return api.rpcServer.cache.dhtCache._getBootstrapInfo();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
api.registerMethod("get_connected_peers", {
|
|
||||||
cacheable: false,
|
|
||||||
async handler(): Promise<string[]> {
|
|
||||||
// @ts-ignore
|
|
||||||
return [...api.rpcServer.cache.dhtCache.connectedTo];
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
api.registerMethod("broadcast_request", {
|
api.registerMethod("broadcast_request", {
|
||||||
cacheable: false,
|
cacheable: false,
|
||||||
async handler(req: RPCBroadcastRequest): Promise<RPCBroadcastResponse> {
|
async handler(req: RPCBroadcastRequest): Promise<RPCBroadcastResponse> {
|
||||||
|
|
Loading…
Reference in New Issue