├── Caddyfile ├── package.json ├── v2ray.json ├── README.md ├── .gitignore ├── v2ray.js ├── caddy.sh ├── Dockerfile └── index.html /Caddyfile: -------------------------------------------------------------------------------- 1 | test 2 | { 3 | log ./caddy.log 4 | proxy /ray :6555 { 5 | websocket 6 | header_upstream -Origin 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "oneshell", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "v2ray.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "qrcode-terminal": "^0.12.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /v2ray.json: -------------------------------------------------------------------------------- 1 | { 2 | "inbounds": [ 3 | { 4 | "port": 2333, 5 | "protocol": "vmess", 6 | "settings": { 7 | "clients": [ 8 | { 9 | "id": "uuid", 10 | "alterId": 64 11 | } 12 | ] 13 | }, 14 | "streamSettings": { 15 | "network": "ws", 16 | "wsSettings": { 17 | "path": "/one" 18 | } 19 | } 20 | } 21 | ], 22 | "outbounds": [ 23 | { 24 | "protocol": "freedom", 25 | "settings": {} 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 一键 V2ray websocket + TLS 2 | 3 | 一键就完事了,扫描二维码 或者 复制 vmess链接 无需关心复杂的V2ray 配置,websocket + tls 更安全,伪装更好。 4 | 5 | * 自动生成 UUID (调用系统UUID库) 6 | * 默认使用 caddy 自动获取证书 7 | * 自动生成 安卓 v2rayNG vmess链接 8 | * 自动生成 iOS shadowrocket vmess链接 9 | * 自动生成 iOS 二维码 10 | 11 | ## 使用方法 12 | 13 | * 提前安装好docker 14 | ``` 15 | curl -fsSL https://get.docker.com -o get-docker.sh && \ 16 | bash get-docker.sh 17 | ``` 18 | * 解析好域名 确认 你的域名正确解析到了你安装的这台服务器 19 | * 会占用 443 和 80 端口请提前确认没有跑其他的业务 ( lsof -i:80 和 lsof -i:443 能查看) 20 | * 请将下面命令中的 YOURDOMAIN.COM(域名)替换成自己的域名(此IP解析的域名)!!! 21 | 22 | ``` 23 | sudo docker run -d --rm --name v2ray -p 443:443 -p 80:80 -v $HOME/.caddy:/root/.caddy pengchujin/v2ray_ws:0.08 YOURDOMAIN.COM V2RAY_WS && sleep 3s && sudo docker logs v2ray 24 | ``` 25 | * 如果你想指定固定 uuid 的话, 0890b53a-e3d4-4726-bd2b-52574e8588c4 这个 uuid 改为你自己的,https://www.uuidgenerator.net/ 这个网站可以生成随机 uuid。 26 | ``` 27 | sudo docker run -d --rm --name v2ray -p 443:443 -p 80:80 -v $HOME/.caddy:/root/.caddy pengchujin/v2ray_ws:0.08 YOURDOMAIN.COM V2RAY_WS 0890b53a-e3d4-4726-bd2b-52574e8588c4 && sleep 3s && sudo docker logs v2ray 28 | ``` 29 | 30 | * 命令执行完会显示链接信息,如果想查看链接信息,执行下面命令即可 31 | ``` 32 | sudo docker logs v2ray 33 | ``` 34 | * 想停止这个 docker 和服务 35 | ``` 36 | sudo docker stop v2ray 37 | ``` 38 | 39 | 有问题欢迎提issue, 感谢大家。参考了 caddy docker 和 v2ray 的 dockerfile 感谢! 40 | 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # parcel-bundler cache (https://parceljs.org/) 61 | .cache 62 | 63 | # next.js build output 64 | .next 65 | 66 | # nuxt.js build output 67 | .nuxt 68 | 69 | # vuepress build output 70 | .vuepress/dist 71 | 72 | # Serverless directories 73 | .serverless/ 74 | 75 | # FuseBox cache 76 | .fusebox/ 77 | 78 | #DynamoDB Local files 79 | .dynamodb/ -------------------------------------------------------------------------------- /v2ray.js: -------------------------------------------------------------------------------- 1 | var qrcode = require('qrcode-terminal'); 2 | var fs = require('fs'); 3 | fs.readFile('sebs.js', 'utf8', function (err, data) { 4 | if (err) throw err; 5 | node = JSON.parse(data); 6 | console.log('-----------------iOS小火箭链接--------------------') 7 | console.log(ios(node).toString()) 8 | console.log('-----------------安卓 v2rayNG链接-----------------') 9 | console.log(android(node).toString()) 10 | qrcode.generate(ios(node).toString(), {small: true},function (qrcode) { 11 | console.log('-----------------iOS 小火箭二维码------------------') 12 | console.log(qrcode); 13 | }); 14 | }); 15 | function ios(node) { 16 | !node.method ? node.method = 'chacha20-poly1305' : '' 17 | let v2rayBase = '' + node.method + ':' + node.id + '@' + node.add + ':' + node.port 18 | let remarks = '' 19 | // let obfsParam = '' 20 | let path = '' 21 | let obfs = '' 22 | let tls = '' 23 | !node.ps ? remarks = 'remarks=oneSubscribe' : remarks = `remarks=${node.ps}` 24 | !node.path ? '' : path = `&path=${node.path}` 25 | node.net == 'ws' ? obfs = `&obfs=websocket` : '' 26 | node.net == 'h2' ? obfs = `&obfs=http` : '' 27 | node.tls == 'tls' ? tls = `&tls=1` : '' 28 | let query = remarks + path + obfs + tls 29 | let baseV2ray = Buffer.from(v2rayBase).toString('base64') 30 | let server = Buffer.from('vmess://' + baseV2ray + '?' + query) 31 | return server 32 | } 33 | 34 | function android(node) { 35 | node.v = "2" 36 | // node.path = node.path.replace(/\//, '') 37 | delete node.method 38 | let baseV2ray = Buffer.from(JSON.stringify(node)).toString('base64') 39 | let server = Buffer.from('vmess://' + baseV2ray) 40 | return server 41 | } 42 | 43 | -------------------------------------------------------------------------------- /caddy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # FILE="/etc/Caddy" 3 | domain="$1" 4 | psname="$2" 5 | uuid="51be9a06-299f-43b9-b713-1ec5eb76e3d7" 6 | if [ ! "$3" ] ;then 7 | uuid=$(uuidgen) 8 | echo "uuid 将会系统随机生成" 9 | else 10 | uuid="$3" 11 | fi 12 | cat > /etc/Caddyfile <<'EOF' 13 | domain 14 | { 15 | log ./caddy.log 16 | proxy /ws :2333 { 17 | websocket 18 | header_upstream -Origin 19 | } 20 | } 21 | 22 | EOF 23 | sed -i "s/domain/${domain}/" /etc/Caddyfile 24 | 25 | # v2ray 26 | cat > /etc/v2ray/config.json <<'EOF' 27 | { 28 | "inbounds": [ 29 | { 30 | "port": 2333, 31 | "protocol": "vmess", 32 | "settings": { 33 | "clients": [ 34 | { 35 | "id": "uuid", 36 | "alterId": 64 37 | } 38 | ] 39 | }, 40 | "streamSettings": { 41 | "network": "ws", 42 | "wsSettings": { 43 | "path": "/ws" 44 | } 45 | } 46 | } 47 | ], 48 | "outbounds": [ 49 | { 50 | "protocol": "freedom", 51 | "settings": {} 52 | } 53 | ] 54 | } 55 | 56 | EOF 57 | 58 | sed -i "s/uuid/${uuid}/" /etc/v2ray/config.json 59 | 60 | cat > /srv/sebs.js <<'EOF' 61 | { 62 | "add":"domain", 63 | "aid":"0", 64 | "host":"", 65 | "id":"uuid", 66 | "net":"ws", 67 | "path":"/ws", 68 | "port":"443", 69 | "ps":"sebsclub", 70 | "tls":"tls", 71 | "type":"none", 72 | "v":"2" 73 | } 74 | EOF 75 | 76 | if [ "$psname" != "" ] && [ "$psname" != "-c" ]; then 77 | sed -i "s/sebsclub/${psname}/" /srv/sebs.js 78 | sed -i "s/domain/${domain}/" /srv/sebs.js 79 | sed -i "s/uuid/${uuid}/" /srv/sebs.js 80 | else 81 | $* 82 | fi 83 | pwd 84 | cp /etc/Caddyfile . 85 | nohup /bin/parent caddy --log stdout --agree=false & 86 | echo "配置 JSON 详情" 87 | echo " " 88 | cat /etc/v2ray/config.json 89 | echo " " 90 | node v2ray.js 91 | /usr/bin/v2ray -config /etc/v2ray/config.json 92 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Builder 3 | # 4 | FROM abiosoft/caddy:builder as builder 5 | 6 | ARG version="1.0.3" 7 | ARG plugins="git,cors,realip,expires,cache" 8 | 9 | 10 | RUN go get -v github.com/abiosoft/parent 11 | RUN go get -v golang.org/x/crypto/ed25519 12 | RUN VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=false /bin/sh /usr/bin/builder.sh 13 | 14 | # 15 | # Final stage 16 | # 17 | FROM alpine:3.8 18 | # process wrapper 19 | LABEL maintainer "sebs sebsclub@outlook.com" 20 | 21 | # V2RAY 22 | ARG TZ="Asia/Shanghai" 23 | 24 | ENV TZ ${TZ} 25 | ENV V2RAY_VERSION v4.21.3 26 | ENV V2RAY_LOG_DIR /var/log/v2ray 27 | ENV V2RAY_CONFIG_DIR /etc/v2ray/ 28 | ENV V2RAY_DOWNLOAD_URL https://github.com/v2ray/v2ray-core/releases/download/${V2RAY_VERSION}/v2ray-linux-64.zip 29 | 30 | RUN apk upgrade --update \ 31 | && apk add \ 32 | bash \ 33 | tzdata \ 34 | curl \ 35 | && mkdir -p \ 36 | ${V2RAY_LOG_DIR} \ 37 | ${V2RAY_CONFIG_DIR} \ 38 | /tmp/v2ray \ 39 | && curl -L -H "Cache-Control: no-cache" -o /tmp/v2ray/v2ray.zip ${V2RAY_DOWNLOAD_URL} \ 40 | && pwd \ 41 | && unzip /tmp/v2ray/v2ray.zip -d /tmp/v2ray/ \ 42 | && mv /tmp/v2ray/v2ray /usr/bin \ 43 | && mv /tmp/v2ray/v2ctl /usr/bin \ 44 | && mv /tmp/v2ray/vpoint_vmess_freedom.json /etc/v2ray/config.json \ 45 | && chmod +x /usr/bin/v2ray \ 46 | && chmod +x /usr/bin/v2ctl \ 47 | && apk del curl \ 48 | && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \ 49 | && echo ${TZ} > /etc/timezone \ 50 | && rm -rf /tmp/v2ray /var/cache/apk/* 51 | 52 | # ADD entrypoint.sh /entrypoint.sh 53 | WORKDIR /srv 54 | # node 55 | # install node 56 | RUN apk add --no-cache util-linux 57 | RUN apk add --update nodejs nodejs-npm 58 | COPY package.json /srv/package.json 59 | RUN npm install 60 | COPY v2ray.js /srv/v2ray.js 61 | 62 | ARG version="1.0.3" 63 | LABEL caddy_version="$version" 64 | 65 | # Let's Encrypt Agreement 66 | ENV ACME_AGREE="false" 67 | 68 | # Telemetry Stats 69 | ENV ENABLE_TELEMETRY="false" 70 | 71 | RUN apk add --no-cache openssh-client git 72 | 73 | # install caddy 74 | COPY --from=builder /install/caddy /usr/bin/caddy 75 | 76 | # validate install 77 | RUN /usr/bin/caddy -version 78 | RUN /usr/bin/caddy -plugins 79 | 80 | 81 | VOLUME /root/.caddy /srv 82 | # WORKDIR /srv 83 | 84 | COPY Caddyfile /etc/Caddyfile 85 | COPY index.html /srv/index.html 86 | # COPY package.json /etc/package.json 87 | # install process wrapper 88 | COPY --from=builder /go/bin/parent /bin/parent 89 | ADD caddy.sh /caddy.sh 90 | EXPOSE 443 80 91 | ENTRYPOINT ["/caddy.sh"] 92 | # CMD ["--conf", "/etc/Caddyfile", "--log", "stdout", "--agree=$ACME_AGREE"] 93 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | Apache2 Ubuntu Default Page: It works 12 | 192 | 193 | 194 |
195 | 201 | 219 |
220 | 221 | 222 |
223 |
224 | It works! 225 |
226 |
227 |

228 | This is the default welcome page used to test the correct 229 | operation of the Apache2 server after installation on Ubuntu systems. 230 | It is based on the equivalent page on Debian, from which the Ubuntu Apache 231 | packaging is derived. 232 | If you can read this page, it means that the Apache HTTP server installed at 233 | this site is working properly. You should replace this file (located at 234 | /var/www/html/index.html) before continuing to operate your HTTP server. 235 |

236 | 237 | 238 |

239 | If you are a normal user of this web site and don't know what this page is 240 | about, this probably means that the site is currently unavailable due to 241 | maintenance. 242 | If the problem persists, please contact the site's administrator. 243 |

244 | 245 |
246 |
247 |
248 | Configuration Overview 249 |
250 |
251 |

252 | Ubuntu's Apache2 default configuration is different from the 253 | upstream default configuration, and split into several files optimized for 254 | interaction with Ubuntu tools. The configuration system is 255 | fully documented in 256 | /usr/share/doc/apache2/README.Debian.gz. Refer to this for the full 257 | documentation. Documentation for the web server itself can be 258 | found by accessing the manual if the apache2-doc 259 | package was installed on this server. 260 | 261 |

262 |

263 | The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows: 264 |

265 |
266 | /etc/apache2/
267 | |-- apache2.conf
268 | |       `--  ports.conf
269 | |-- mods-enabled
270 | |       |-- *.load
271 | |       `-- *.conf
272 | |-- conf-enabled
273 | |       `-- *.conf
274 | |-- sites-enabled
275 | |       `-- *.conf
276 |           
277 |
    278 |
  • 279 | apache2.conf is the main configuration 280 | file. It puts the pieces together by including all remaining configuration 281 | files when starting up the web server. 282 |
  • 283 | 284 |
  • 285 | ports.conf is always included from the 286 | main configuration file. It is used to determine the listening ports for 287 | incoming connections, and this file can be customized anytime. 288 |
  • 289 | 290 |
  • 291 | Configuration files in the mods-enabled/, 292 | conf-enabled/ and sites-enabled/ directories contain 293 | particular configuration snippets which manage modules, global configuration 294 | fragments, or virtual host configurations, respectively. 295 |
  • 296 | 297 |
  • 298 | They are activated by symlinking available 299 | configuration files from their respective 300 | *-available/ counterparts. These should be managed 301 | by using our helpers 302 | 303 | a2enmod, 304 | a2dismod, 305 | 306 | 307 | a2ensite, 308 | a2dissite, 309 | 310 | and 311 | 312 | a2enconf, 313 | a2disconf 314 | . See their respective man pages for detailed information. 315 |
  • 316 | 317 |
  • 318 | The binary is called apache2. Due to the use of 319 | environment variables, in the default configuration, apache2 needs to be 320 | started/stopped with /etc/init.d/apache2 or apache2ctl. 321 | Calling /usr/bin/apache2 directly will not work with the 322 | default configuration. 323 |
  • 324 |
325 |
326 | 327 |
328 |
329 | Document Roots 330 |
331 | 332 |
333 |

334 | By default, Ubuntu does not allow access through the web browser to 335 | any file apart of those located in /var/www, 336 | public_html 337 | directories (when enabled) and /usr/share (for web 338 | applications). If your site is using a web document root 339 | located elsewhere (such as in /srv) you may need to whitelist your 340 | document root directory in /etc/apache2/apache2.conf. 341 |

342 |

343 | The default Ubuntu document root is /var/www/html. You 344 | can make your own virtual hosts under /var/www. This is different 345 | to previous releases which provides better security out of the box. 346 |

347 |
348 | 349 |
350 |
351 | Reporting Problems 352 |
353 |
354 |

355 | Please use the ubuntu-bug tool to report bugs in the 356 | Apache2 package with Ubuntu. However, check existing bug reports before reporting a new bug. 359 |

360 |

361 | Please report bugs specific to modules (such as PHP and others) 362 | to respective packages, not to the web server itself. 363 |

364 |
365 | 366 | 367 | 368 | 369 |
370 |
371 |
372 |
373 | 374 | 375 | 376 | --------------------------------------------------------------------------------