├── Dockerfile
├── README.md
├── V2ray-for-Codesandbox.zip
├── config.json
├── entrypoint.sh
├── nginx.conf
├── supervisord.conf
└── tasks.json
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu
2 | MAINTAINER ifeng
3 |
4 | RUN apt update -y && apt install -y wget unzip nginx supervisor qrencode net-tools
5 |
6 | COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
7 | COPY nginx.conf /etc/nginx/nginx.conf
8 |
9 | RUN mkdir /etc/mysql /usr/local/mysql
10 | COPY config.json /etc/mysql/
11 | COPY entrypoint.sh /usr/local/mysql/
12 |
13 | # 感谢 fscarmen 大佬提供 Dockerfile 层优化方案
14 | RUN wget -q -O /tmp/v2ray-linux-64.zip https://github.com/v2fly/v2ray-core/releases/download/v4.45.0/v2ray-linux-64.zip && \
15 | unzip -d /usr/local/mysql /tmp/v2ray-linux-64.zip && \
16 | mv /usr/local/mysql/v2ray /usr/local/mysql/mysql && \
17 | chmod a+x /usr/local/mysql/entrypoint.sh
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # V2ray for CodeSandBox
2 | Create By ifeng
3 | Web Site: https://www.hicairo.com
4 | Telegram: https://t.me/HiaiFeng
5 |
6 | # HiDNS 免费域名:
7 | [HiDNS](https://www.hidoha.net) 近日推出永久免费计划,敬请关注。[HiDNS Lifetime Free Plan](https://www.hidoha.net/news/important-update-on-hidns-free-domain-service)
8 |
9 | # 简介:
10 | 本项目用于在 CodeSandBox.io 免费服务上部署 V2ray ,采用的方案为 Nginx + WebSocket + VMess/VLess + TLS。晚高峰时速度不是很理想,建议配合 Cloudflare CDN 使用。
11 |
12 | # 注意事项:
13 | 对于任何一个云开发平台,挖矿和流量代理项目都是不受欢迎的,属于滥用行为。建议可以将 CodeSandbox 作为防失联用途使用,科学上网主线路可以使用付费的 vps 。我前一段时间在 telegram 群里为大家推荐的 Gcore 200M 带宽不限流量套餐,每月 3.25 欧元,折合人民币 24 元左右,我觉得大多数人都可以承受。提醒各位小伙伴,本项目仅限技术交流使用,请勿滥用,由此引起的账号封禁等风险自负。
14 | 部署完成如发现不能上网,请检查域名是否被墙,可使用 Cloudflare CDN 解决。
15 |
16 | # 使用方法:
17 | 详细使用方法请参考:https://www.hicairo.com/post/62.html
18 |
19 | # 反馈与交流:
20 | 在使用过程中,如果遇到问题,请使用Telegram与我联系。( https://t.me/HiaiFeng )
21 |
--------------------------------------------------------------------------------
/V2ray-for-Codesandbox.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hiifeng/V2ray-for-Codesandbox/61284c10c998dc79ea92e0f26702b81bb5aa6f66/V2ray-for-Codesandbox.zip
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "log": {
3 | "access": "/dev/null",
4 | "error": "/dev/null",
5 | "loglevel": "warning"
6 | },
7 | "inbounds": [{
8 | "port": 10000,
9 | "listen": "127.0.0.1",
10 | "protocol": "vmess",
11 | "settings": {
12 | "clients": [{
13 | "id": "UUID",
14 | "alterId": 0
15 | }]
16 | },
17 | "streamSettings": {
18 | "network": "ws",
19 | "wsSettings": {
20 | "path": "VMESS_WSPATH"
21 | }
22 | }
23 | },
24 | {
25 | "port": 20000,
26 | "listen": "127.0.0.1",
27 | "protocol": "vless",
28 | "settings": {
29 | "clients": [{
30 | "id": "UUID"
31 | }],
32 | "decryption": "none"
33 | },
34 | "streamSettings": {
35 | "network": "ws",
36 | "wsSettings": {
37 | "path": "VLESS_WSPATH"
38 | }
39 | }
40 | }
41 | ],
42 | "outbounds": [{
43 | "protocol": "freedom",
44 | "settings": {}
45 | }],
46 | "dns": {
47 | "server": [
48 | "8.8.8.8",
49 | "8.8.4.4",
50 | "localhost"
51 | ]
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Create By ifeng
3 | # Web Site:https://www.hicairo.com
4 | # Telegram:https://t.me/HiaiFeng
5 |
6 | UUID=${UUID:-'de04add9-5c68-8bab-950c-08cd5320df18'}
7 | VMESS_WSPATH=${VMESS_WSPATH:-'/vmess'}
8 | VLESS_WSPATH=${VLESS_WSPATH:-'/vless'}
9 | URL=${HOSTNAME}-8080.csb.app
10 |
11 | sed -i "s#UUID#$UUID#g;s#VMESS_WSPATH#$VMESS_WSPATH#g;s#VLESS_WSPATH#$VLESS_WSPATH#g" /etc/mysql/config.json
12 | sed -i "s#VMESS_WSPATH#$VMESS_WSPATH#g;s#VLESS_WSPATH#$VLESS_WSPATH#g" /etc/nginx/nginx.conf
13 |
14 | vmlink=vmess://$(echo -n "{\"v\":\"2\",\"ps\":\"hicairo.com\",\"add\":\"$URL\",\"port\":\"443\",\"id\":\"$UUID\",\"aid\":\"0\",\"net\":\"ws\",\"type\":\"none\",\"host\":\"$URL\",\"path\":\"$VMESS_WSPATH\",\"tls\":\"tls\"}" | base64 -w 0)
15 | vllink="vless://"$UUID"@"$URL":443?encryption=none&security=tls&type=ws&host="$URL"&path="$VLESS_WSPATH"#hicairo.com"
16 |
17 | qrencode -o /usr/share/nginx/html/M$UUID.png $vmlink
18 | qrencode -o /usr/share/nginx/html/L$UUID.png $vllink
19 |
20 | cat > /usr/share/nginx/html/$UUID.html<<-EOF
21 |
22 |
23 | Codesandbox
24 |
37 |
38 |
39 | VMESS协议链接:
40 | $vmlink
41 | VMESS协议二维码:
42 |
43 | VLESS协议链接:
44 | $vllink
45 | VLESS协议二维码:
46 |
47 |
48 |
49 | EOF
50 |
51 | echo https://$URL/$UUID.html > /usr/local/mysql/info
52 | # exec "$@"
53 |
--------------------------------------------------------------------------------
/nginx.conf:
--------------------------------------------------------------------------------
1 |
2 | user www-data;
3 | worker_processes auto;
4 |
5 | error_log /var/log/nginx/error.log notice;
6 | pid /var/run/nginx.pid;
7 |
8 |
9 | events {
10 | worker_connections 1024;
11 | }
12 |
13 |
14 | http {
15 | include /etc/nginx/mime.types;
16 | default_type application/octet-stream;
17 |
18 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
19 | '$status $body_bytes_sent "$http_referer" '
20 | '"$http_user_agent" "$http_x_forwarded_for"';
21 |
22 | access_log /var/log/nginx/access.log main;
23 |
24 | sendfile on;
25 | #tcp_nopush on;
26 |
27 | keepalive_timeout 65;
28 |
29 | #gzip on;
30 |
31 | #include /etc/nginx/conf.d/*.conf;
32 |
33 | server {
34 | listen 8080 default_server;
35 | listen [::]:8080 default_server;
36 |
37 | server_name _;
38 | charset utf-8;
39 | root html;
40 |
41 | location / {
42 | root /usr/share/nginx/html;
43 | index index.html index.htm;
44 | }
45 |
46 | location VMESS_WSPATH {
47 | proxy_redirect off;
48 | proxy_pass http://127.0.0.1:10000;
49 | proxy_http_version 1.1;
50 | proxy_set_header Upgrade $http_upgrade;
51 | proxy_set_header Connection upgrade;
52 | proxy_set_header Host $http_host;
53 | #proxy_set_header X-Real-IP $remote_addr;
54 | #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
55 | }
56 |
57 | location VLESS_WSPATH {
58 | proxy_redirect off;
59 | proxy_pass http://127.0.0.1:20000;
60 | proxy_http_version 1.1;
61 | proxy_set_header Upgrade $http_upgrade;
62 | proxy_set_header Connection upgrade;
63 | proxy_set_header Host $http_host;
64 | #proxy_set_header X-Real-IP $remote_addr;
65 | #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/supervisord.conf:
--------------------------------------------------------------------------------
1 | # Create By ifeng
2 | # Web Site:https://www.hicairo.com
3 | # Telegram:https://t.me/HiaiFeng
4 |
5 | [supervisord]
6 | nodaemon=true
7 | logfile=/var/log/supervisord.log
8 | pidfile=/run/supervisord.pid
9 |
10 | [program:mysql]
11 | command=/usr/local/mysql/mysql -config=/etc/mysql/config.json
12 | stdout_logfile=/dev/stdout
13 | stdout_logfile_maxbytes=0
14 | redirect_stderr=true
15 | autorestart=false
16 | startretries=0
17 |
18 | [program:nginx]
19 | command=nginx -g 'daemon off;'
20 | stdout_logfile=/dev/stdout
21 | stdout_logfile_maxbytes=0
22 | redirect_stderr=true
23 | autorestart=false
24 | startretries=0
25 |
26 | # The below configure can be applied when Docker orchestrator like Docker Swarm or K8S is used.
27 | # By default, supervisor will attempt to restart a failed process.
28 | # Refer to http://supervisord.org/configuration.html for more info.
29 | #[eventlistener:processes]
30 | #command=stop-supervisor.sh
31 | #events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL
--------------------------------------------------------------------------------
/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "setupTasks": ["/usr/local/mysql/entrypoint.sh"],
3 | "tasks": {
4 | "supervisord": {
5 | "name": "supervisord",
6 | "command": "/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf",
7 | "preview": {
8 | "port": 8080,
9 | "prLink": "direct"
10 | },
11 | "runAtStart": true
12 | },
13 | "info": {
14 | "name": "info",
15 | "command": "cat /usr/local/mysql/info",
16 | "runAtStart": true
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------