Compare commits

...

5 Commits

9 changed files with 21084 additions and 3053 deletions

View File

@ -1,44 +0,0 @@
pipeline:
build:
image: git.lumeweb.com/lumeweb/ci-node
commands:
- apt-get update && apt-get install libunbound-dev
- 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_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

View File

@ -1,2 +0,0 @@
nodeLinker: node-modules

View File

@ -1,48 +0,0 @@
import MagicString from "magic-string";
import astMatcher from "ast-matcher";
import path from "path";
import fs from "fs";
export default {
name: "bundle-hsd-names-db",
transform(src, id, ast) {
if (!id.includes("reserved.js")) {
return false;
}
const magicString = new MagicString(src);
astMatcher.setParser(this.parse);
if (!ast) {
try {
ast = this.parse(src);
} catch (e) {
throw e;
}
}
const findNamesDb = astMatcher("const DATA = fs.readFileSync(FILE)");
const findNamesDbMatches = findNamesDb(ast);
if (!findNamesDbMatches?.length) {
return false;
}
const dbPath = path.join(path.dirname(id), "names.db");
const dbData = fs.readFileSync(dbPath);
magicString.overwrite(
findNamesDbMatches[0].node.start,
findNamesDbMatches[0].node.end,
`const DATA = Buffer.from("${dbData.toString("base64")}","base64")`
);
return {
code: magicString.toString(),
map: magicString.generateMap({
source: src,
includeContent: true,
hires: true,
}),
};
},
};

21058
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +1,17 @@
{ {
"name": "relay-plugin-handshake", "name": "@lumeweb/relay-plugin-handshake",
"type": "module", "type": "module",
"packageManager": "yarn@3.3.0",
"scripts": { "scripts": {
"build": "rollup -c rollup.config.js" "prepare": "presetter bootstrap",
"build": "run build",
"semantic-release": "semantic-release"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-commonjs": "^23.0.7", "@lumeweb/presetter-relay-plugin-preset": "^0.1.0-develop.8",
"@rollup/plugin-json": "^5.0.2", "presetter": "^4.0.1"
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-typescript": "^10.0.1",
"@types/node": "^18.15.11",
"esbuild": "^0.15.18",
"prettier": "^2.8.7",
"rollup": "^3.20.3",
"tslib": "^2.5.0",
"typescript": "^4.9.5",
"vite": "^4.2.1"
}, },
"dependencies": { "dependencies": {
"@lumeweb/libhyperproxy": "git+https://git.lumeweb.com/LumeWeb/libhyperproxy.git", "@lumeweb/interface-relay": "^0.0.2-develop.1",
"@lumeweb/relay-plugin-rollup-preset": "git+https://git.lumeweb.com/LumeWeb/relay-plugin-rollup-preset.git", "@lumeweb/libhyperproxy": "^0.0.2-develop.1"
"@lumeweb/relay-types": "git+https://git.lumeweb.com/LumeWeb/relay-types.git",
"hsd": "github:LumeWeb/hsd#spv-namestate",
"object-merger": "^1.0.3",
"random-key": "^0.3.2"
} }
} }

View File

@ -1,5 +1,7 @@
{ {
"core": {
"plugins": [ "plugins": [
"handshake" "handshake"
] ]
}
} }

View File

@ -1,14 +1,14 @@
import type { Plugin, PluginAPI } from "@lumeweb/relay-types"; import type { Plugin, PluginAPI } from "@lumeweb/interface-relay";
// @ts-ignore // @ts-ignore
import rand from "random-key"; import rand from "random-key";
// @ts-ignore // @ts-ignore
import FullNode from "hsd/lib/node/fullnode.js"; import FullNode from "hsd/lib/node/fullnode.js";
import { MultiSocketProxy } from "@lumeweb/libhyperproxy"; import { MultiSocketProxy } from "@lumeweb/libhyperproxy";
let server: FullNode;
let api: PluginAPI; let api: PluginAPI;
const PROTOCOL = "lumeweb.proxy.handshake"; const PROTOCOL = "lumeweb.proxy.handshake";
const DNS_PROTOCOL = "lumeweb.proxy.handshake.dns";
const plugin: Plugin = { const plugin: Plugin = {
name: "handshake", name: "handshake",
@ -27,6 +27,19 @@ const plugin: Plugin = {
muxer, muxer,
}); });
}); });
const dnsProxy = new MultiSocketProxy({
swarm: api.swarm,
protocol: DNS_PROTOCOL,
allowedPorts: [53],
server: true,
});
api.protocols.register(DNS_PROTOCOL, (peer: any, muxer: any) => {
dnsProxy.handlePeer({
peer,
muxer,
});
});
}, },
}; };

View File

@ -1,14 +0,0 @@
{
"compilerOptions": {
"target": "es2020",
"module": "esnext",
"moduleResolution": "node",
"rootDir": "src",
"outDir": "dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true
}
}

2922
yarn.lock

File diff suppressed because it is too large Load Diff