Skip to content
Open

1 #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 使用官方 Node.js 镜像作为基础镜像
FROM node:lts-alpine3.18

# 设置工作目录
WORKDIR /app

# 将应用程序文件复制到容器中
COPY . .

# EXPOSE 3000

# 安装应用程序的依赖
RUN npm install

# 设置默认的命令,即启动应用程序
CMD ["npm", "start"]
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
不能说的秘密
5 changes: 3 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
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);

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));
Expand All @@ -28,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:'));
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down