From d3679c28ea91e4d0989f9082b6e4c2f9c43c5356 Mon Sep 17 00:00:00 2001 From: Yang Linxin Date: Wed, 18 Jun 2025 17:12:15 +0800 Subject: [PATCH 1/3] Init support on XHTTP configuration when boot up with xray. Dockerfile.xray is only for building test enviroment, config file which from /etc/v2raya/config.json(inner container) can be used host xray exec. --- Dockerfile.xray | 31 +++++++++++++ gui/src/components/modalServer.vue | 73 ++++++++++++++++++++++++++++-- service/core/coreObj/coreObj.go | 7 +++ service/core/serverObj/v2ray.go | 24 ++++++++++ 4 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 Dockerfile.xray diff --git a/Dockerfile.xray b/Dockerfile.xray new file mode 100644 index 00000000..bc7a95ce --- /dev/null +++ b/Dockerfile.xray @@ -0,0 +1,31 @@ +FROM mzz2017/git:alpine AS version +WORKDIR /build +ADD .git ./.git +RUN git describe --abbrev=0 --tags | tee ./version + + +FROM node:lts-alpine AS builder-web +ADD gui /build/gui +WORKDIR /build/gui +RUN echo "network-timeout 600000" >> .yarnrc +#RUN yarn config set registry https://registry.npm.taobao.org +#RUN yarn config set sass_binary_site https://cdn.npm.taobao.org/dist/node-sass -g +RUN yarn cache clean && yarn && yarn build + +FROM golang:alpine AS builder +ADD service /build/service +WORKDIR /build/service +ENV GO111MODULE=on +ENV GOPROXY=https://goproxy.cn +COPY --from=version /build/version ./ +COPY --from=builder-web /build/web server/router/web +RUN export VERSION=$(cat ./version) && CGO_ENABLED=0 go build -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${VERSION:1} -s -w" -o v2raya . + +FROM teddysun/xray +COPY --from=builder /build/service/v2raya /usr/bin/ +# RUN wget -O /usr/local/share/v2ray/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat +RUN apk add --no-cache iptables ip6tables tzdata +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA +EXPOSE 2017 +VOLUME /etc/v2raya +ENTRYPOINT ["v2raya"] diff --git a/gui/src/components/modalServer.vue b/gui/src/components/modalServer.vue index bd434b50..abce3ef8 100644 --- a/gui/src/components/modalServer.vue +++ b/gui/src/components/modalServer.vue @@ -114,12 +114,21 @@ ref="v2ray_aid" v-model="v2ray.aid" placeholder="AlterID" type="number" min="0" v-show="v2ray.tls === 'tls' || v2ray.tls === 'reality'" label="uTLS fingerprint" label-position="on-border" > - + > + + + + + + + + + + HTTP/2 + - + + + + + + + + + + + + + + + + + + Date: Thu, 4 Dec 2025 09:58:40 +0800 Subject: [PATCH 2/3] Add bash to direct run v2raya image into xray container in linux. --- Dockerfile.xray | 2 +- docker-run.sh | 13 +++++++++++++ service/core/coreObj/coreObj.go | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 docker-run.sh diff --git a/Dockerfile.xray b/Dockerfile.xray index bc7a95ce..1d45df92 100644 --- a/Dockerfile.xray +++ b/Dockerfile.xray @@ -24,7 +24,7 @@ RUN export VERSION=$(cat ./version) && CGO_ENABLED=0 go build -ldflags="-X githu FROM teddysun/xray COPY --from=builder /build/service/v2raya /usr/bin/ # RUN wget -O /usr/local/share/v2ray/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat -RUN apk add --no-cache iptables ip6tables tzdata +RUN apk add --no-cache nftables iptables ip6tables iptables-legacy tzdata LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 2017 VOLUME /etc/v2raya diff --git a/docker-run.sh b/docker-run.sh new file mode 100644 index 00000000..803777c8 --- /dev/null +++ b/docker-run.sh @@ -0,0 +1,13 @@ +#!/bin/bash +docker stop xray 2>/dev/null +docker rm xray 2>/dev/null +docker run -d \ + --restart=always \ + --privileged \ + --network=host \ + --name xray \ + -e V2RAYA_ADDRESS=0.0.0.0:2017 \ + -v /lib/modules:/lib/modules:ro \ + -v /etc/resolv.conf:/etc/resolv.conf \ + # -v /etc/v2raya:/etc/v2raya \ + v2raya diff --git a/service/core/coreObj/coreObj.go b/service/core/coreObj/coreObj.go index 29e841aa..2fe04289 100644 --- a/service/core/coreObj/coreObj.go +++ b/service/core/coreObj/coreObj.go @@ -260,9 +260,9 @@ type QuicSettings struct { } type XHTTPSettings struct { - Path string `json:"path"` + Path string `json:"path"` Host string `json:"host,omitempty"` - Mode string `json:"mode,omitempty"` + Mode string `json:"mode,omitempty"` } type Hosts map[string][]string From 05111926f3e14018f0b673e64c99e57abd13aac8 Mon Sep 17 00:00:00 2001 From: Yang Linxin Date: Thu, 4 Dec 2025 14:29:41 +0800 Subject: [PATCH 3/3] Fix merge conflict errors. --- docker-run.sh | 2 +- gui/src/components/modalServer.vue | 40 +++++++++++------------------- service/core/coreObj/coreObj.go | 5 ---- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/docker-run.sh b/docker-run.sh index 803777c8..8613c2d8 100644 --- a/docker-run.sh +++ b/docker-run.sh @@ -9,5 +9,5 @@ docker run -d \ -e V2RAYA_ADDRESS=0.0.0.0:2017 \ -v /lib/modules:/lib/modules:ro \ -v /etc/resolv.conf:/etc/resolv.conf \ - # -v /etc/v2raya:/etc/v2raya \ + -v /etc/v2raya:/etc/v2raya \ v2raya diff --git a/gui/src/components/modalServer.vue b/gui/src/components/modalServer.vue index 32f54468..9376b068 100644 --- a/gui/src/components/modalServer.vue +++ b/gui/src/components/modalServer.vue @@ -88,6 +88,13 @@ v-show="v2ray.tls === 'tls' || v2ray.tls === 'reality'" label="uTLS fingerprint" + + + @@ -187,6 +194,7 @@ v-if="v2ray.protocol === 'vless' && v2ray.tls !== 'none'" ref="v2ray_flow" label - - - - - - - - - - - - + + + + + +