diff options
| author | crupest <crupest@outlook.com> | 2023-05-31 23:55:57 +0800 | 
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2023-05-31 23:55:57 +0800 | 
| commit | 4cc25bea963c09a1eb0f951bed1eabc75d196446 (patch) | |
| tree | 2f5aa4fe9684a19463255b454162cc84d35ccc2a /template | |
| parent | 4e6260b7d03a38be65203139631d5fda523e80af (diff) | |
| download | crupest-4cc25bea963c09a1eb0f951bed1eabc75d196446.tar.gz crupest-4cc25bea963c09a1eb0f951bed1eabc75d196446.tar.bz2 crupest-4cc25bea963c09a1eb0f951bed1eabc75d196446.zip  | |
Add v2ray.
Diffstat (limited to 'template')
| -rw-r--r-- | template/docker-compose.yaml.template | 16 | ||||
| -rw-r--r-- | template/nginx/root.conf.template | 17 | ||||
| -rw-r--r-- | template/v2ray-client-config.json.template | 46 | ||||
| -rw-r--r-- | template/v2ray-config.json.template | 29 | 
4 files changed, 108 insertions, 0 deletions
diff --git a/template/docker-compose.yaml.template b/template/docker-compose.yaml.template index ad3b0ab..b2e3fe9 100644 --- a/template/docker-compose.yaml.template +++ b/template/docker-compose.yaml.template @@ -65,6 +65,7 @@ services:        - code-server-network        - auto-certbot-network        - crupest-api-network +      - v2ray-network    crupest-api:      pull_policy: build @@ -80,6 +81,19 @@ services:      networks:        - crupest-api-network +  crupest-v2ray: +    image: v2fly/v2fly-core:latest +    pull_policy: always +    command: [ "-c", "/etc/v2fly/config.json" ] +    container_name: crupest-v2ray +    restart: on-failure:3 +    volumes: +      - "./v2ray-config.json:/etc/v2fly/config.json:ro" +    expose: +      - "10000:10000" +    networks: +      - v2ray-network +    auto-certbot:      pull_policy: build      depends_on: @@ -163,6 +177,8 @@ networks:    code-server-network:    auto-certbot-network:    crupest-api-network: +  v2ray-network: +  volumes:    blog-public: diff --git a/template/nginx/root.conf.template b/template/nginx/root.conf.template index dfedc81..f148db8 100644 --- a/template/nginx/root.conf.template +++ b/template/nginx/root.conf.template @@ -11,6 +11,22 @@ server {          root /srv/www;      } +    location /_$CRUPEST_V2RAY_PATH { +        if ($http_upgrade != "websocket") { +            return 404; +        } + +        proxy_redirect off; +        proxy_http_version 1.1; +        proxy_set_header Upgrade $http_upgrade; +        proxy_set_header Connection $connection_upgrade; +        proxy_set_header Host $host; +        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +        proxy_set_header X-Forwarded-Proto $scheme; +        proxy_set_header X-Real-IP $remote_addr; +        proxy_pass http://crupest-v2ray:10000; +    } +      location /api {          proxy_http_version 1.1;          proxy_set_header Upgrade $http_upgrade; @@ -21,6 +37,7 @@ server {          proxy_set_header X-Real-IP $remote_addr;          proxy_pass http://crupest-api;      } +  }  server { diff --git a/template/v2ray-client-config.json.template b/template/v2ray-client-config.json.template new file mode 100644 index 0000000..0c99c6d --- /dev/null +++ b/template/v2ray-client-config.json.template @@ -0,0 +1,46 @@ +{ +    "inbounds": [ +        { +            "port": 1080, +            "listen": "127.0.0.1", +            "protocol": "socks", +            "sniffing": { +                "enabled": true, +                "destOverride": [ +                    "http", +                    "tls" +                ] +            }, +            "settings": { +                "auth": "noauth", +                "udp": false +            } +        } +    ], +    "outbounds": [ +        { +            "protocol": "vmess", +            "settings": { +                "vnext": [ +                    { +                        "address": "$CRUPEST_DOMAIN", +                        "port": 443, +                        "users": [ +                            { +                                "id": "$CRUPEST_V2RAY_TOKEN", +                                "alterId": 0 +                            } +                        ] +                    } +                ] +            }, +            "streamSettings": { +                "network": "ws", +                "security": "tls", +                "wsSettings": { +                    "path": "/_$CRUPEST_V2RAY_PATH" +                } +            } +        } +    ] +}
\ No newline at end of file diff --git a/template/v2ray-config.json.template b/template/v2ray-config.json.template new file mode 100644 index 0000000..33d3f16 --- /dev/null +++ b/template/v2ray-config.json.template @@ -0,0 +1,29 @@ +{ +    "inbounds": [ +        { +            "port": 10000, +            "listen": "0.0.0.0", +            "protocol": "vmess", +            "settings": { +                "clients": [ +                    { +                        "id": "$CRUPEST_V2RAY_TOKEN", +                        "alterId": 0 +                    } +                ] +            }, +            "streamSettings": { +                "network": "ws", +                "wsSettings": { +                    "path": "/_$CRUPEST_V2RAY_PATH" +                } +            } +        } +    ], +    "outbounds": [ +        { +            "protocol": "freedom", +            "settings": {} +        } +    ] +}
\ No newline at end of file  | 
