mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
Merge pull request #1774 from YLinXin/main
Support XHTTP Powered by Xray
This commit is contained in:
5 files changed
+222
-36
No files matched your search
@@ -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"]
|
||||
@@ -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
|
||||
@@ -55,18 +55,61 @@
|
||||
<option v-if="variant() === 'xray'" value="xtls">xtls</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
<b-field v-if="v2ray.tls !== 'none'" label="SNI" label-position="on-border">
|
||||
<b-input ref="v2ray_sni" v-model="v2ray.sni" placeholder="SNI" expanded />
|
||||
<b-field
|
||||
v-if="v2ray.tls !== 'none'"
|
||||
label="SNI"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
ref="v2ray_sni"
|
||||
v-model="v2ray.sni"
|
||||
placeholder="SNI"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.tls === 'tls' || v2ray.tls === 'reality'" label="uTLS fingerprint"
|
||||
label-position="on-border">
|
||||
<b-input ref="v2ray_fp" v-model="v2ray.fp" placeholder="A uTLS compatable fingerprint name" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.tls === 'tls' || v2ray.tls === 'reality'" label="uTLS fingerprint"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-select
|
||||
ref="v2ray_fp"
|
||||
v-model="v2ray.fp"
|
||||
expanded
|
||||
>
|
||||
<option value="">empty</option>
|
||||
<option value="chrome">chrome</option>
|
||||
<option value="firefox">firefox</option>
|
||||
<option value="safari">safari</option>
|
||||
<option value="ios">ios</option>
|
||||
<option value="android">android</option>
|
||||
<option value="edge">edge</option>
|
||||
<option value="random">random</option>
|
||||
<option value="randomized">randomized</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
<b-field v-if="v2ray.protocol === 'vless' && v2ray.tls !== 'none'" ref="v2ray_flow" label="Flow"
|
||||
label-position="on-border">
|
||||
<b-input ref="v2ray_flow" v-model="v2ray.flow" placeholder="Flow" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.tls === 'tls'"
|
||||
label="Alpn"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input v-model="v2ray.alpn" placeholder="h3,h2,http/1.1" expanded />
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.tls === 'reality'" label="pbk" label-position="on-border">
|
||||
<b-field
|
||||
v-if="v2ray.protocol === 'vless' && v2ray.tls !== 'none'" ref="v2ray_flow" label="Flow"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
ref="v2ray_flow"
|
||||
v-model="v2ray.flow"
|
||||
placeholder="Flow"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
<b-field
|
||||
v-show="v2ray.tls === 'reality'"
|
||||
label="pbk"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input v-model="v2ray.pbk" placeholder="pbk" expanded />
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.tls === 'reality'" label="sid" label-position="on-border">
|
||||
@@ -101,7 +144,7 @@
|
||||
<option value="h2">HTTP/2</option>
|
||||
<option value="grpc">gRPC</option>
|
||||
<option value="quic">QUIC</option>
|
||||
<option v-if="variant() === 'xray'" value="xhttp">XHTTP</option>
|
||||
<option value="xhttp">XHTTP</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.net === 'tcp'" label="Type" label-position="on-border">
|
||||
@@ -148,33 +191,102 @@
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.net === 'ws' ||
|
||||
v2ray.net === 'h2' ||
|
||||
v2ray.tls === 'tls' ||
|
||||
(v2ray.net === 'tcp' && v2ray.type === 'http')
|
||||
" label="Host" label-position="on-border">
|
||||
<b-input v-model="v2ray.host" :placeholder="$t('configureServer.hostObfuscation')" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.net === 'ws' ||
|
||||
v2ray.net === 'h2' ||
|
||||
v2ray.net === 'xhttp' ||
|
||||
v2ray.tls === 'tls' ||
|
||||
(v2ray.net === 'tcp' && v2ray.type === 'http')
|
||||
"
|
||||
label="Host"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
v-model="v2ray.host"
|
||||
:placeholder="$t('configureServer.hostObfuscation')"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.tls === 'tls'" label="Alpn" label-position="on-border">
|
||||
<b-input v-model="v2ray.alpn" placeholder="h2,http/1.1" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.net === 'ws' ||
|
||||
v2ray.net === 'h2' ||
|
||||
(v2ray.net === 'tcp' && v2ray.type === 'http')
|
||||
"
|
||||
label="Path"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
v-model="v2ray.path"
|
||||
:placeholder="$t('configureServer.pathObfuscation')"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.net === 'ws' ||
|
||||
v2ray.net === 'h2' ||
|
||||
(v2ray.net === 'tcp' && v2ray.type === 'http')
|
||||
" label="Path" label-position="on-border">
|
||||
<b-input v-model="v2ray.path" :placeholder="$t('configureServer.pathObfuscation')" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.net === 'mkcp' || v2ray.net === 'kcp'"
|
||||
label="Seed"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
v-model="v2ray.path"
|
||||
:placeholder="$t('configureServer.seedObfuscation')"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.net === 'mkcp' || v2ray.net === 'kcp'" label="Seed" label-position="on-border">
|
||||
<b-input v-model="v2ray.path" :placeholder="$t('configureServer.seedObfuscation')" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.net === 'grpc'"
|
||||
label="Service Name"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
ref="v2ray_service_name"
|
||||
v-model="v2ray.path"
|
||||
type="text"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.net === 'grpc'" label="Service Name" label-position="on-border">
|
||||
<b-input ref="v2ray_service_name" v-model="v2ray.path" type="text" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.net === 'xhttp'"
|
||||
label="Path"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
v-model="v2ray.path"
|
||||
:placeholder="$t('configureServer.pathObfuscation')"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.net === 'quic'" label="Key" label-position="on-border">
|
||||
<b-input ref="v2ray_key" v-model="v2ray.key" :placeholder="$t('configureServer.password')" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.net === 'xhttp'"
|
||||
label="Mode"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-select v-model="v2ray.xhttpMode" expanded>
|
||||
<option value="auto">auto</option>
|
||||
<option value="packet-up">packet-up</option>
|
||||
<option value="stream-up">stream-up</option>
|
||||
<option value="stream-one">stream-one</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
<b-field v-show="v2ray.net === 'xhttp'" label="path" label-position="on-border">
|
||||
<b-input v-model="v2ray.path" placeholder="XHTTP Path" expanded />
|
||||
<b-field
|
||||
v-show="v2ray.net === 'xhttp'"
|
||||
label="Extra Raw JSON"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
v-model="v2ray.xhttpRawJson"
|
||||
placeholder="{XHTTPObject}"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
<b-field
|
||||
v-show="v2ray.net === 'quic'"
|
||||
label="Key"
|
||||
label-position="on-border"
|
||||
>
|
||||
<b-input
|
||||
ref="v2ray_key" v-model="v2ray.key" :placeholder="$t('configureServer.password')"
|
||||
expanded
|
||||
/>
|
||||
</b-field>
|
||||
</b-tab-item>
|
||||
<b-tab-item label="SS">
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user