Compare commits

...

8 Commits

6 changed files with 50 additions and 60 deletions

View File

@ -6,7 +6,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "./ci/publish.sh \"${nextRelease.version}\""
"publishCmd": "git clone https://git.lumeweb.com/LumeWeb/circle-ci-publish.git ci; ./ci/publish.sh \"${nextRelease.version}\""
}
],
[

View File

@ -1,18 +0,0 @@
#!/bin/bash
if ! command -v go &>/dev/null; then
sudo apt-get update && sudo apt-get install -y golang
fi
sudo go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
sudo chmod +x /root/go/bin/nfpm
yq -i ".version=\"${1}\"" nfpm.yaml
sudo /root/go/bin/nfpm package -p deb
if ! command -v pip &>/dev/null; then
sudo apt-get update && sudo apt-get install -y python-pip
fi
pip2 install --upgrade cloudsmith-cli
cloudsmith push deb lumeweb/lume-web-relay *.deb

65
package-lock.json generated
View File

@ -1,15 +1,15 @@
{
"name": "@lumeweb/relay",
"version": "0.0.0-development",
"version": "0.1.0-develop.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/relay",
"version": "0.0.0-development",
"version": "0.1.0-develop.1",
"hasInstallScript": true,
"dependencies": {
"@fastify/websocket": "^7.2.0",
"@fastify/websocket": "^8.1.0",
"@hyperswarm/dht-relay": "^0.4.0",
"@lumeweb/cfg": "git+https://git.lumeweb.com/LumeWeb/cfg.git",
"@lumeweb/interface-relay": "git+https://git.lumeweb.com/LumeWeb/interface-relay",
@ -23,7 +23,7 @@
"ed25519-keygen": "github:LumeWeb/ed25519-keygen",
"ethers": "^5.7.2",
"eventemitter2": "^6.4.9",
"fastify": "^4.15.0",
"fastify": "^4.19.2",
"fetch-blob": "github:LumeWeb/fetch-blob",
"hyperswarm": "^4.4.0",
"json-stable-stringify": "^1.0.2",
@ -38,7 +38,7 @@
"pino-pretty": "^9.4.0",
"promise-retry": "^2.0.1",
"protomux": "^3.4.1",
"protomux-rpc": "^1.3.0",
"protomux-rpc": "^1.4.1",
"random-key": "^0.3.2",
"slugify": "^1.6.6",
"sodium-universal": "^4.0.0"
@ -939,17 +939,17 @@
"integrity": "sha512-KAfcLa+CnknwVi5fWogrLXgidLic+GXnLjijXdpl8pvkvbXU5BGa37iZO9FGvsh9ZL4y+oFi5cbHBm5UOG+dmQ=="
},
"node_modules/@fastify/fast-json-stringify-compiler": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@fastify/fast-json-stringify-compiler/-/fast-json-stringify-compiler-4.2.0.tgz",
"integrity": "sha512-ypZynRvXA3dibfPykQN3RB5wBdEUgSGgny8Qc6k163wYPLD4mEGEDkACp+00YmqkGvIm8D/xYoHajwyEdWD/eg==",
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@fastify/fast-json-stringify-compiler/-/fast-json-stringify-compiler-4.3.0.tgz",
"integrity": "sha512-aZAXGYo6m22Fk1zZzEUKBvut/CIIQe/BapEORnxiD5Qr0kPHqqI69NtEMCme74h+at72sPhbkb4ZrLd1W3KRLA==",
"dependencies": {
"fast-json-stringify": "^5.0.0"
"fast-json-stringify": "^5.7.0"
}
},
"node_modules/@fastify/websocket": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@fastify/websocket/-/websocket-7.2.0.tgz",
"integrity": "sha512-vhWQCT0I5a1JIKc34LXHQ2earW7kViYvhGn5x+lZr8TIOJKmx6NJk0Bw9zGWakulXhMsu/0y89QnsUnHiII9ag==",
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/@fastify/websocket/-/websocket-8.1.0.tgz",
"integrity": "sha512-7Tk+ODgvS/S9IyPXuXDU1v5tpchAeSWFH0B3Ldz+cnBKy5+lEmuj4ncLhVUzXgn9w3ycX/Vhf1mEEkcemBFUIQ==",
"dependencies": {
"fastify-plugin": "^4.0.0",
"ws": "^8.0.0"
@ -3726,25 +3726,26 @@
"integrity": "sha512-cIusKBIt/R/oI6z/1nyfe2FvGKVTohVRfvkOhvx0nCEW+xf5NoCXjAHcWp93uOUBchzYcsvPlrapAdX1uW+YGg=="
},
"node_modules/fastify": {
"version": "4.15.0",
"resolved": "https://registry.npmjs.org/fastify/-/fastify-4.15.0.tgz",
"integrity": "sha512-m/CaRN8nf5uyYdrDe2qqq+0z3oGyE+A++qlKQoLJTI4WI0nWK9D6R3FxXQ3MVwt/md977GMR4F43pE9oqrS2zw==",
"version": "4.19.2",
"resolved": "https://registry.npmjs.org/fastify/-/fastify-4.19.2.tgz",
"integrity": "sha512-2unheeIRWFf9/Jjcz7djOpKuXCTzZjlyFfiBwKqpldkHMN2rfTLu/f9pYTdwlhzC9Cdj0S2H12zlug0Kd5uZ1w==",
"dependencies": {
"@fastify/ajv-compiler": "^3.5.0",
"@fastify/error": "^3.0.0",
"@fastify/fast-json-stringify-compiler": "^4.2.0",
"@fastify/error": "^3.2.0",
"@fastify/fast-json-stringify-compiler": "^4.3.0",
"abstract-logging": "^2.0.1",
"avvio": "^8.2.0",
"avvio": "^8.2.1",
"fast-content-type-parse": "^1.0.0",
"fast-json-stringify": "^5.7.0",
"find-my-way": "^7.6.0",
"light-my-request": "^5.6.1",
"pino": "^8.5.0",
"process-warning": "^2.0.0",
"light-my-request": "^5.9.1",
"pino": "^8.12.0",
"process-warning": "^2.2.0",
"proxy-addr": "^2.0.7",
"rfdc": "^1.3.0",
"secure-json-parse": "^2.5.0",
"semver": "^7.3.7",
"tiny-lru": "^10.0.0"
"semver": "^7.5.0",
"tiny-lru": "^11.0.1"
}
},
"node_modules/fastify-plugin": {
@ -9318,9 +9319,9 @@
}
},
"node_modules/pino": {
"version": "8.11.0",
"resolved": "https://registry.npmjs.org/pino/-/pino-8.11.0.tgz",
"integrity": "sha512-Z2eKSvlrl2rH8p5eveNUnTdd4AjJk8tAsLkHYZQKGHP4WTh2Gi1cOSOs3eWPqaj+niS3gj4UkoreoaWgF3ZWYg==",
"version": "8.14.1",
"resolved": "https://registry.npmjs.org/pino/-/pino-8.14.1.tgz",
"integrity": "sha512-8LYNv7BKWXSfS+k6oEc6occy5La+q2sPwU3q2ljTX5AZk7v+5kND2o5W794FyRaqha6DJajmkNRsWtPpFyMUdw==",
"dependencies": {
"atomic-sleep": "^1.0.0",
"fast-redact": "^3.1.1",
@ -9715,9 +9716,9 @@
}
},
"node_modules/protomux-rpc": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/protomux-rpc/-/protomux-rpc-1.3.0.tgz",
"integrity": "sha512-G+zCpEujLsW+lQ75YXVdPfXKzxnP5F7IceVyz2B1ypWdH4NDf2n2ObkoUjdUrEMWgn+3fjXdY7ehkXLac+mNPQ==",
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/protomux-rpc/-/protomux-rpc-1.4.1.tgz",
"integrity": "sha512-J0WuK5uxyj1sKpGaM5dYvZGa3JRHDLpZI0qgENto8OXXDSPNGvcTQVuyKUFlFoxHYVm20RIsUhiWYZwzfuBMKA==",
"dependencies": {
"bits-to-bytes": "^1.0.0",
"compact-encoding": "^2.6.1",
@ -11167,9 +11168,9 @@
"integrity": "sha512-SVqEcMZBsZF9mA78rjzCrYrUs37LMJk3ShZ851ygZYW1cMeIjs9mL57KO6Iv5mmjSQnOe/29/VAfGXo+oRCiVw=="
},
"node_modules/tiny-lru": {
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-10.4.1.tgz",
"integrity": "sha512-buLIzw7ppqymuO3pt10jHk/6QMeZLbidihMQU+N6sogF6EnBzG0qtDWIHuhw1x3dyNgVL/KTGIZsTK81+yCzLg==",
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-11.0.1.tgz",
"integrity": "sha512-iNgFugVuQgBKrqeO/mpiTTgmBsTP0WL6yeuLfLs/Ctf0pI/ixGqIRm8sDCwMcXGe9WWvt2sGXI5mNqZbValmJg==",
"engines": {
"node": ">=12"
}

View File

@ -1,7 +1,7 @@
{
"name": "@lumeweb/relay",
"type": "commonjs",
"version": "0.1.0-develop.1",
"version": "0.1.0-develop.2",
"description": "",
"main": "build/index.js",
"repository": {
@ -20,7 +20,7 @@
"postinstall": "patch-package"
},
"dependencies": {
"@fastify/websocket": "^7.2.0",
"@fastify/websocket": "^8.1.0",
"@hyperswarm/dht-relay": "^0.4.0",
"@lumeweb/cfg": "git+https://git.lumeweb.com/LumeWeb/cfg.git",
"@lumeweb/interface-relay": "git+https://git.lumeweb.com/LumeWeb/interface-relay",
@ -34,7 +34,7 @@
"ed25519-keygen": "github:LumeWeb/ed25519-keygen",
"ethers": "^5.7.2",
"eventemitter2": "^6.4.9",
"fastify": "^4.15.0",
"fastify": "^4.19.2",
"fetch-blob": "github:LumeWeb/fetch-blob",
"hyperswarm": "^4.4.0",
"json-stable-stringify": "^1.0.2",
@ -49,7 +49,7 @@
"pino-pretty": "^9.4.0",
"promise-retry": "^2.0.1",
"protomux": "^3.4.1",
"protomux-rpc": "^1.3.0",
"protomux-rpc": "^1.4.1",
"random-key": "^0.3.2",
"slugify": "^1.6.6",
"sodium-universal": "^4.0.0"

View File

@ -26,6 +26,7 @@ switch (os.platform()) {
config.inject({
"core.confDir": configDir,
"core.port": 8080,
"core.relayPort": 0,
"core.appPort": 80,
"core.logLevel": "info",
"core.pluginDir": path.resolve(configDir, "..", "plugins"),

View File

@ -16,18 +16,24 @@ import * as http2 from "http2";
import websocket from "@fastify/websocket";
export async function start() {
const dht = getSwarm();
const swarm = getSwarm();
let relayServer = fastify({
http2: true,
logger: log.child({ module: "relay-server" }),
});
relayServer.register(websocket);
await relayServer.register(websocket);
relayServer.get("/", { websocket: true }, (connection) => {
relay(dht, new Stream(false, connection.socket));
relay(swarm.dht, new Stream(false, connection.socket));
connection.socket.binaryType = "nodebuffer";
});
await relayServer.listen({ port: config.uint("core.port"), host: "0.0.0.0" });
let port = config.uint("core.relayPort");
if (!port) {
port = config.uint("core.port");
}
await relayServer.listen({ port, host: "0.0.0.0" });
}