This commit is contained in:
quackerd 2021-01-23 06:07:27 -05:00
parent 1bc24b1445
commit 9276361ac5
Signed by: d
GPG Key ID: F73412644EDE357A
7 changed files with 34 additions and 64 deletions

View File

@ -1,4 +1,6 @@
{
"id": "{{ id }}",
"alterId": {{ alterid }}
"flow": "xtls-rprx-direct",
"level": 0,
"email": "dummy@dummy.com"
}

View File

@ -27,7 +27,7 @@ clients:
# comment: for a managed environment we recommend hardcoding the id:
# the generated id does NOT currently back-propagate to this file
# you WILL lose existing users if you run configure.py multiple times with blank ids as they will be regenerated with random ids
id:
id: ahaha
# alterid: the alterid as appeared in v2ray config file
# default: 64
alterid:

View File

@ -132,15 +132,6 @@ def main():
template = jinja2.Template(f.read())
with open(path, "w") as f:
f.write(template.render(template_dict))
# generate NGINX conf
with open(NGINX_IN, "r") as f:
template = jinja2.Template(f.read())
path = os.path.join(OUTPUT_DIR, NGINX_PATH)
os.makedirs(path, exist_ok=True)
path = os.path.join(path, NGINX_FN)
with open(path, "w") as f:
f.write(template.render(template_dict))
# generate v2ray conf
with open(SERVER_IN, "r") as f:

View File

@ -1,18 +1,18 @@
version: '3.0'
networks:
br-v2ray:
br-xray:
external: false
services:
nginx:
container_name: v2ray_nginx
container_name: xray_nginx
image: linuxserver/swag
restart: always
restart: unless-stopped
cap_add:
- NET_ADMIN
networks:
- br-v2ray
- br-xray
environment:
- PUID={{ uid }}
- PGID={{ gid }}
@ -26,18 +26,18 @@ services:
- STAGING=false
ports:
- 80:80
- 443:443
volumes:
- ./nginx/default:/config/nginx/site-confs/default
- ./nginx/logs:/config/log
- ./certs:/etc/letsencrypt/live/{{ domain }}
v2ray:
container_name: v2ray_v2ray
image: teddysun/v2ray
container_name: xray_xray
image: teddysun/xray
restart: unless-stopped
networks:
- br-v2ray
command: ["v2ray","-config=/etc/v2ray/config.json"]
ports:
- 443:443
volumes:
- ./v2ray/config.json:/etc/v2ray/config.json
- ./xray/config.json:/etc/xray/config.json
- ./certs:/certs
{{ watchtower }}

View File

@ -1,34 +0,0 @@
# redirect all traffic to https
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
# main server block
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
root /config/www;
index index.html index.htm index.php;
# all ssl related config moved to ssl.conf
include /config/nginx/ssl.conf;
server_name {{ subdomain }}.{{ domain }};
location /{{ path }} {
proxy_redirect off;
proxy_pass http://v2ray_v2ray:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
# Show realip in v2ray access.log
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

View File

@ -1,18 +1,29 @@
{
"inbounds": [
{
"port": 8080,
"listen":"0.0.0.0",
"protocol": "vmess",
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{{ clients }}
],
"decryption": "none",
"fallbacks": [
{
"dest": "xray_nginx:80"
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/{{ path }}"
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"certificates:": [
{
"certificateFile": "/certs/fullchain.pem",
"keyFile": "/certs/privkey.pem"
}
]
}
}
}

View File

@ -1,8 +1,8 @@
watchtower:
container_name: v2ray_watchtower
container_name: xray_watchtower
image: containrrr/watchtower
restart: unless-stopped
networks:
- br-v2ray
- br-xray
volumes:
- /var/run/docker.sock:/var/run/docker.sock