From 3017a3fde3bb36f0e37371cc6546a14ad4a9ea34 Mon Sep 17 00:00:00 2001 From: gaboolic <23441099@qq.com> Date: Fri, 21 Jul 2023 11:24:41 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..454566cb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# 使用官方 Node.js 镜像作为基础镜像 +FROM node:lts-alpine3.18 + +# 设置工作目录 +WORKDIR /app + +# 将应用程序文件复制到容器中 +COPY . . + +# 安装应用程序的依赖 +RUN npm install + +# 设置默认的命令,即启动应用程序 +CMD ["npm", "start"] From 2a9faf6224cdf8390730ce57859154a78a093482 Mon Sep 17 00:00:00 2001 From: gaboolic <23441099@qq.com> Date: Fri, 21 Jul 2023 11:24:58 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/README.md b/README.md index 03986471..3c8c1768 100644 --- a/README.md +++ b/README.md @@ -1,11 +1 @@ -把[edgetunnel](https://github.com/zizifn/edgetunnel)改造成普通nodejs项目,实现vless协议,代码参考了https://github.com/zizifn/edgetunnel/blob/main/src/worker-vless.js - -原项目只能部署在cloudflare的worker,准备改成普通node项目部署在别处 - -目前http可以了,https不行,发现https情况下是一次on connection内收到多次on message,需要合并 - -使用: - -npm install - -npm start +不能说的秘密 \ No newline at end of file From c4e8910ff0aa72d804c7ff3af20459875795751f Mon Sep 17 00:00:00 2001 From: gaboolic <23441099@qq.com> Date: Fri, 21 Jul 2023 15:39:15 +0800 Subject: [PATCH 3/6] EXPOSE 3000 --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 454566cb..10344872 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,8 @@ WORKDIR /app # 将应用程序文件复制到容器中 COPY . . +EXPOSE 3000 + # 安装应用程序的依赖 RUN npm install From 0c6dbdf1f98ee336c58ca44440a829b7b05f9219 Mon Sep 17 00:00:00 2001 From: gaboolic <23441099@qq.com> Date: Fri, 21 Jul 2023 16:03:23 +0800 Subject: [PATCH 4/6] const { TextDecoder } = require('util'); --- Dockerfile | 2 +- app.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 10344872..c9409e2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /app # 将应用程序文件复制到容器中 COPY . . -EXPOSE 3000 +# EXPOSE 3000 # 安装应用程序的依赖 RUN npm install diff --git a/app.js b/app.js index 284943b9..fa6c53dd 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,6 @@ const net=require('net'); const {WebSocket,createWebSocketStream}=require('ws'); +const { TextDecoder } = require('util'); const logcb= (...args)=>console.log.bind(this,...args); const errcb= (...args)=>console.error.bind(this,...args); From 84fa3249415c154e1efee5b8e3c7a4ad04db0e82 Mon Sep 17 00:00:00 2001 From: gaboolic <23441099@qq.com> Date: Mon, 24 Jul 2023 13:02:25 +0800 Subject: [PATCH 5/6] main --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2704830c..eec6b18e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nodejs-proxy", "version": "1.0.0", "description": "", - "main": "index.js", + "main": "app.js", "scripts": { "start": "node app.js", "test": "echo \"Error: no test specified\" && exit 1" From d14b6933411fe80dc71e0786f439e9fb75278045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=20dong?= <89151271+zhainan678@users.noreply.github.com> Date: Thu, 27 Jul 2023 18:48:18 +0800 Subject: [PATCH 6/6] Update app.js --- app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index fa6c53dd..eb8bf18a 100644 --- a/app.js +++ b/app.js @@ -4,7 +4,7 @@ const { TextDecoder } = require('util'); const logcb= (...args)=>console.log.bind(this,...args); const errcb= (...args)=>console.error.bind(this,...args); -const uuid= (process.env.UUID||'d342d11e-d424-4583-b36e-524ab1f0afa4').replace(/-/g, ""); +const uuid= (process.env.UUID||'6d34dbe4-bd55-42b7-99e1-84644b683119').replace(/-/g, ""); const port= process.env.PORT||3000; const wss=new WebSocket.Server({port},logcb('listen:', port)); @@ -29,4 +29,4 @@ wss.on('connection', ws=>{ duplex.on('error',errcb('E1:')).pipe(this).on('error',errcb('E2:')).pipe(duplex); }).on('error',errcb('Conn-Err:',{host,port})); }).on('error',errcb('EE:')); -}); \ No newline at end of file +});