diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000000000000000000000000000000000..0385ef7566ca977ef2990d6b272f35c542d8de1e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "ts-node", + "type": "node", + "request": "launch", + "args": [ + "${relativeFile}" + ], + "env": { + "TS_NODE_COMPILER_OPTIONS":"{\"noUnusedLocals\":false}" + }, + "runtimeArgs": [ + "--preserve-symlinks", + "-r", + "ts-node/register" + ], + "cwd": "${workspaceRoot}", + "protocol": "inspector", + "console": "internalConsole", + // "outputCapture": "std" + } + ] +} \ No newline at end of file diff --git a/cw/package.json b/cw/package.json index 61377c6c0e30b6e8e5de4464ec6577685f3b7997..8cd3726f7a2c9f54306988fd15b78949ee0e329b 100644 --- a/cw/package.json +++ b/cw/package.json @@ -12,6 +12,7 @@ "dependencies": { "@noble/secp256k1": "^1.5.5", "async-retry": "^1.3.3", + "commander": "^9.2.0", "eciesjs": "^0.3.14", "koa-compose": "^4.1.0" } diff --git a/cw/src/cli.ts b/cw/src/cli.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/cw/src/server.ts b/cw/src/server.ts index 8c72f69f331b856e578501db2d337f1e6a251a52..d29c55b27e5e7f3be0aa5cb7cf443661d1a261df 100644 --- a/cw/src/server.ts +++ b/cw/src/server.ts @@ -22,6 +22,9 @@ export const capabilities = [ export async function handleConnection(conn: Socket) { + conn.on("data", (d) => { + console.log(d) + }) const rAddr = `${conn.remoteAddress}:${conn.remotePort}` console.log(`New connection from ${rAddr}`) conn.setKeepAlive() diff --git a/cw/src/utils.ts b/cw/src/utils.ts index 0010d4ff5f022d78e5a58c2c8ef3305fbbe70ce7..67cff81c4adf75e862a4ee01cff74f9df953f73f 100644 --- a/cw/src/utils.ts +++ b/cw/src/utils.ts @@ -41,7 +41,9 @@ export const writeEncUB = async (conn: Socket, cipher: Cipher, d: any) => { } export async function waitForDataUB(s: Socket): Promise<Buffer> { - return new Promise(res => s.once("data", res)) + return new Promise(res => + s.once("data", res) + ) } export async function waitForEncDataUB(s: Socket, decipher: Decipher) { diff --git a/cw/yarn.lock b/cw/yarn.lock index 7683d11724b53771cd704b4c4d687010ea725ca3..d2ce43c74ec45d00c05554a579dfad4f674992f7 100644 --- a/cw/yarn.lock +++ b/cw/yarn.lock @@ -203,6 +203,11 @@ brorand@^1.1.0: resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= +commander@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.2.0.tgz#6e21014b2ed90d8b7c9647230d8b7a94a4a419a9" + integrity sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w== + create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"