diff --git a/Dockerfile.xray b/Dockerfile.xray
new file mode 100644
index 00000000..1d45df92
--- /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 nftables iptables ip6tables iptables-legacy tzdata
+LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA
+EXPOSE 2017
+VOLUME /etc/v2raya
+ENTRYPOINT ["v2raya"]
diff --git a/docker-run.sh b/docker-run.sh
new file mode 100644
index 00000000..8613c2d8
--- /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/gui/src/components/modalServer.vue b/gui/src/components/modalServer.vue
index 968169d7..9376b068 100644
--- a/gui/src/components/modalServer.vue
+++ b/gui/src/components/modalServer.vue
@@ -55,18 +55,61 @@
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
+
+
+
@@ -101,7 +144,7 @@
-
+
@@ -148,33 +191,102 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
@@ -631,6 +743,8 @@ export default {
allowInsecure: false,
protocol: "vmess",
key: "none",
+ xhttpMode: "auto",
+ xhttpRawJson: "",
},
ss: {
method: "2022-blake3-aes-128-gcm",
@@ -834,6 +948,8 @@ export default {
spx: u.params.spx || "",
allowInsecure: u.params.allowInsecure || false,
key: u.params.key,
+ xhttpMode: u.params.xhttpMode || "auto",
+ xhttpRawJson: u.params.xhttpRawJson || "",
protocol: "vless",
};
if (o.alpn !== "") {
@@ -1072,6 +1188,12 @@ export default {
query.key = srcObj.key;
query.quicSecurity = srcObj.quicSecurity;
}
+ if (srcObj.net === "xhttp") {
+ query.xhttpMode = srcObj.xhttpMode;
+ if (srcObj.xhttpRawJson) {
+ query.xhttpRawJson = srcObj.xhttpRawJson;
+ }
+ }
if (query.security == "reality") {
query.pbk = srcObj.pbk;
query.sid = srcObj.sid;
diff --git a/service/core/coreObj/coreObj.go b/service/core/coreObj/coreObj.go
index 4bf82016..a91a926b 100644
--- a/service/core/coreObj/coreObj.go
+++ b/service/core/coreObj/coreObj.go
@@ -155,9 +155,6 @@ type StreamSettings struct {
QuicSettings *QuicSettings `json:"quicSettings,omitempty"`
Sockopt *Sockopt `json:"sockopt,omitempty"`
}
-type XHTTPSettings struct {
- Path string `json:"path,omitempty"`
-}
type RealitySettings struct {
ServerName string `json:"serverName,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
@@ -257,6 +254,11 @@ type QuicSettings struct {
Key string `json:"key,omitempty"`
Security string `json:"security"`
}
+type XHTTPSettings struct {
+ Path string `json:"path"`
+ Host string `json:"host,omitempty"`
+ Mode string `json:"mode,omitempty"`
+}
type Hosts map[string][]string
type DNS struct {
diff --git a/service/core/serverObj/v2ray.go b/service/core/serverObj/v2ray.go
index 15444c0a..7ac2749c 100644
--- a/service/core/serverObj/v2ray.go
+++ b/service/core/serverObj/v2ray.go
@@ -52,6 +52,7 @@ type V2Ray struct {
AllowInsecure bool `json:"allowInsecure"`
Key string `json:"key,omitempty"`
QuicSecurity string `json:"quicSecurity"`
+ XHTTPMode string `json:"xhttpMode,omitempty"`
V string `json:"v"`
Protocol string `json:"protocol"`
}
@@ -114,6 +115,12 @@ func ParseVlessURL(vless string) (data *V2Ray, err error) {
if data.Net == "quic" {
data.QuicSecurity = u.Query().Get("quicSecurity")
}
+ if data.Net == "xhttp" {
+ data.XHTTPMode = u.Query().Get("xhttpMode")
+ if data.XHTTPMode == "" {
+ data.XHTTPMode = "auto"
+ }
+ }
return data, nil
}
@@ -370,8 +377,17 @@ func (v *V2Ray) Configuration(info PriorInfo) (c Configuration, err error) {
Security: v.QuicSecurity,
}
case "xhttp":
- core.StreamSettings.XHTTPSettings = &coreObj.XHTTPSettings{
- Path: v.Path,
+ if v.Host != "" {
+ core.StreamSettings.XHTTPSettings = &coreObj.XHTTPSettings{
+ Path: v.Path,
+ Host: v.Host,
+ Mode: v.XHTTPMode,
+ }
+ } else {
+ core.StreamSettings.XHTTPSettings = &coreObj.XHTTPSettings{
+ Path: v.Path,
+ Mode: v.XHTTPMode,
+ }
}
default:
return Configuration{}, fmt.Errorf("unexpected transport type: %v", v.Net)
@@ -468,6 +484,8 @@ func (v *V2Ray) ExportToURL() string {
setValue(&query, "quicSecurity", v.QuicSecurity)
case "xhttp":
setValue(&query, "path", v.Path)
+ setValue(&query, "host", v.Host)
+ setValue(&query, "xhttpMode", v.XHTTPMode)
}
if v.TLS != "none" {
setValue(&query, "flow", v.Flow)