mirror of
https://github.com/v2rayA/v2rayA.git
synced 2024-11-25 16:34:19 +08:00
Merge xray support from CI-He-O/v2rayA (#1004)
* added xtls-rprx-vision & uTLS fingerprint * removed node option openssl-legacy-provider * removed node option openssl-legacy-provider * update github action * fix: vless id --------- Co-authored-by: clheo <93776896+Cl-He-O@users.noreply.github.com>
This commit is contained in:
parent
87242dd219
commit
1928283842
6
.github/workflows/release_feat_v5.yml
vendored
6
.github/workflows/release_feat_v5.yml
vendored
@ -62,15 +62,13 @@ jobs:
|
|||||||
cache-dependency-path: gui/yarn.lock
|
cache-dependency-path: gui/yarn.lock
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 2.7
|
ruby-version: 3.2
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -y && sudo apt-get install -y gzip
|
sudo apt-get update -y && sudo apt-get install -y gzip
|
||||||
- name: Build GUI
|
- name: Build GUI
|
||||||
run: |
|
run: |
|
||||||
# https://github.com/webpack/webpack/issues/14532#issuecomment-947012063
|
|
||||||
export NODE_OPTIONS=--openssl-legacy-provider
|
|
||||||
yarn --cwd gui --check-files
|
yarn --cwd gui --check-files
|
||||||
yarn --cwd gui build
|
yarn --cwd gui build
|
||||||
- name: Build v2rayA Binaries
|
- name: Build v2rayA Binaries
|
||||||
@ -131,7 +129,7 @@ jobs:
|
|||||||
- name: Install Package Dependencies
|
- name: Install Package Dependencies
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
run: |
|
run: |
|
||||||
gem install fpm -v 1.13.1
|
gem install fpm -v 1.15.1
|
||||||
sudo apt-get install -y libarchive-tools rpm lintian reprepro gnupg gnupg2 expect tar nsis unzip
|
sudo apt-get install -y libarchive-tools rpm lintian reprepro gnupg gnupg2 expect tar nsis unzip
|
||||||
- name: Package
|
- name: Package
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
@ -10,7 +10,7 @@ WORKDIR /build/gui
|
|||||||
RUN echo "network-timeout 600000" >> .yarnrc
|
RUN echo "network-timeout 600000" >> .yarnrc
|
||||||
#RUN yarn config set registry https://registry.npm.taobao.org
|
#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 config set sass_binary_site https://cdn.npm.taobao.org/dist/node-sass -g
|
||||||
RUN export NODE_OPTIONS=--openssl-legacy-provider && yarn cache clean && yarn && yarn build
|
RUN yarn cache clean && yarn && yarn build
|
||||||
|
|
||||||
FROM golang:alpine AS builder
|
FROM golang:alpine AS builder
|
||||||
ADD service /build/service
|
ADD service /build/service
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
FROM node:lts-alpine AS builder
|
FROM node:lts-alpine AS builder
|
||||||
ADD gui /gui
|
ADD gui /gui
|
||||||
WORKDIR /gui
|
WORKDIR /gui
|
||||||
RUN export NODE_OPTIONS=--openssl-legacy-provider && yarn && yarn build
|
RUN yarn && yarn build
|
||||||
|
|
||||||
FROM nginx:stable-alpine
|
FROM nginx:stable-alpine
|
||||||
COPY --from=builder /web /usr/share/nginx/html
|
COPY --from=builder /web /usr/share/nginx/html
|
||||||
|
@ -13,7 +13,7 @@ WORKDIR /build/gui
|
|||||||
RUN echo "network-timeout 600000" >> .yarnrc
|
RUN echo "network-timeout 600000" >> .yarnrc
|
||||||
#RUN yarn config set registry https://registry.npmmirror.com
|
#RUN yarn config set registry https://registry.npmmirror.com
|
||||||
#RUN yarn config set sass_binary_site https://cdn.npm.taobao.org/dist/node-sass -g
|
#RUN yarn config set sass_binary_site https://cdn.npm.taobao.org/dist/node-sass -g
|
||||||
RUN export NODE_OPTIONS=--openssl-legacy-provider && yarn cache clean && yarn && yarn build
|
RUN yarn cache clean && yarn && yarn build
|
||||||
|
|
||||||
FROM golang:alpine AS builder
|
FROM golang:alpine AS builder
|
||||||
ADD service /build/service
|
ADD service /build/service
|
||||||
|
@ -69,8 +69,6 @@ Function Build-v2rayA(){
|
|||||||
${env:CGO_ENABLED} = "0"
|
${env:CGO_ENABLED} = "0"
|
||||||
#Set yarn's output path
|
#Set yarn's output path
|
||||||
${env:OUTPUT_DIR} = "$CurrentPath/service/server/router/web"
|
${env:OUTPUT_DIR} = "$CurrentPath/service/server/router/web"
|
||||||
#Fix node build error: https://github.com/webpack/webpack/issues/14532#issuecomment-947012063
|
|
||||||
${env:NODE_OPTIONS} = "--openssl-legacy-provider"
|
|
||||||
#Build Web Panel
|
#Build Web Panel
|
||||||
Set-Location -Path "$CurrentPath/gui"
|
Set-Location -Path "$CurrentPath/gui"
|
||||||
yarn; yarn build
|
yarn; yarn build
|
||||||
|
@ -59,6 +59,12 @@
|
|||||||
expanded
|
expanded
|
||||||
/>
|
/>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
<b-field v-if="v2ray.protocol === 'vless'" label="Flow" label-position="on-border">
|
||||||
|
<b-select v-model="v2ray.flow" expanded>
|
||||||
|
<option value="none">none</option>
|
||||||
|
<option value="xtls-rprx-vision">xtls-rprx-vision</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
<b-field
|
<b-field
|
||||||
v-if="v2ray.protocol === 'vmess'"
|
v-if="v2ray.protocol === 'vmess'"
|
||||||
label="AlterID"
|
label="AlterID"
|
||||||
@ -110,6 +116,18 @@
|
|||||||
expanded
|
expanded
|
||||||
/>
|
/>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
<b-field
|
||||||
|
v-show="v2ray.tls === 'tls'"
|
||||||
|
label="uTLS fingerprint"
|
||||||
|
label-position="on-border"
|
||||||
|
>
|
||||||
|
<b-input
|
||||||
|
ref="v2ray_utls_fingerprint"
|
||||||
|
v-model="v2ray.utls_fingerprint"
|
||||||
|
placeholder="A uTLS compatable fingerprint name"
|
||||||
|
expanded
|
||||||
|
/>
|
||||||
|
</b-field>
|
||||||
<b-field
|
<b-field
|
||||||
v-if="v2ray.tls === 'xtls'"
|
v-if="v2ray.tls === 'xtls'"
|
||||||
ref="v2ray_flow"
|
ref="v2ray_flow"
|
||||||
@ -810,13 +828,14 @@ export default {
|
|||||||
add: "",
|
add: "",
|
||||||
port: "",
|
port: "",
|
||||||
id: "",
|
id: "",
|
||||||
aid: "0",
|
flow: "",
|
||||||
|
aid: "",
|
||||||
net: "tcp",
|
net: "tcp",
|
||||||
type: "none",
|
type: "none",
|
||||||
host: "",
|
host: "",
|
||||||
path: "",
|
path: "",
|
||||||
tls: "none",
|
tls: "none",
|
||||||
flow: "none",
|
utls_fingerprint: "",
|
||||||
alpn: "",
|
alpn: "",
|
||||||
scy: "auto",
|
scy: "auto",
|
||||||
v: "",
|
v: "",
|
||||||
@ -973,6 +992,7 @@ export default {
|
|||||||
add: u.host,
|
add: u.host,
|
||||||
port: u.port,
|
port: u.port,
|
||||||
id: decodeURIComponent(u.username),
|
id: decodeURIComponent(u.username),
|
||||||
|
flow: u.params.flow || "",
|
||||||
net: u.params.type || "tcp",
|
net: u.params.type || "tcp",
|
||||||
type: u.params.headerType || "none",
|
type: u.params.headerType || "none",
|
||||||
host: u.params.host || u.params.sni || "",
|
host: u.params.host || u.params.sni || "",
|
||||||
@ -981,6 +1001,7 @@ export default {
|
|||||||
flow: u.params.flow || "none",
|
flow: u.params.flow || "none",
|
||||||
sni: u.params.sni || "",
|
sni: u.params.sni || "",
|
||||||
tls: u.params.security || "none",
|
tls: u.params.security || "none",
|
||||||
|
utls_fingerprint: u.params.fp || "",
|
||||||
allowInsecure: u.params.allowInsecure || false,
|
allowInsecure: u.params.allowInsecure || false,
|
||||||
protocol: "vless",
|
protocol: "vless",
|
||||||
};
|
};
|
||||||
@ -1168,14 +1189,18 @@ export default {
|
|||||||
// https://github.com/XTLS/Xray-core/discussions/716
|
// https://github.com/XTLS/Xray-core/discussions/716
|
||||||
query = {
|
query = {
|
||||||
type: srcObj.net,
|
type: srcObj.net,
|
||||||
|
flow: srcObj.flow,
|
||||||
security: srcObj.tls,
|
security: srcObj.tls,
|
||||||
|
fp: srcObj.utls_fingerprint,
|
||||||
path: srcObj.path,
|
path: srcObj.path,
|
||||||
host: srcObj.host,
|
host: srcObj.host,
|
||||||
headerType: srcObj.type,
|
headerType: srcObj.type,
|
||||||
sni: srcObj.sni,
|
sni: srcObj.host,
|
||||||
flow: srcObj.flow,
|
|
||||||
allowInsecure: srcObj.allowInsecure,
|
allowInsecure: srcObj.allowInsecure,
|
||||||
};
|
};
|
||||||
|
if (srcObj.flow !== "none"){
|
||||||
|
query.flow = srcObj.flow;
|
||||||
|
}
|
||||||
if (srcObj.alpn !== "") {
|
if (srcObj.alpn !== "") {
|
||||||
query.alpn = srcObj.alpn;
|
query.alpn = srcObj.alpn;
|
||||||
}
|
}
|
||||||
@ -1219,9 +1244,6 @@ export default {
|
|||||||
}
|
}
|
||||||
obj.path = "";
|
obj.path = "";
|
||||||
}
|
}
|
||||||
if (!(obj.protocol === "vless" && obj.tls === "xtls")) {
|
|
||||||
delete obj.flow;
|
|
||||||
}
|
|
||||||
return "vmess://" + Base64.encode(JSON.stringify(obj));
|
return "vmess://" + Base64.encode(JSON.stringify(obj));
|
||||||
case "ss":
|
case "ss":
|
||||||
/* ss://BASE64(method:password)@server:port#name */
|
/* ss://BASE64(method:password)@server:port#name */
|
||||||
|
@ -16,8 +16,6 @@ backup=("etc/default/v2raya")
|
|||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$srcdir/v2rayA-$pkgver/gui"
|
cd "$srcdir/v2rayA-$pkgver/gui"
|
||||||
# https://github.com/webpack/webpack/issues/14532#issuecomment-947012063
|
|
||||||
export NODE_OPTIONS=--openssl-legacy-provider
|
|
||||||
yarn --check-files
|
yarn --check-files
|
||||||
OUTPUT_DIR="$srcdir/v2rayA-$pkgver/service/server/router/web" yarn build
|
OUTPUT_DIR="$srcdir/v2rayA-$pkgver/service/server/router/web" yarn build
|
||||||
|
|
||||||
|
@ -125,6 +125,7 @@ type TLSSettings struct {
|
|||||||
Alpn []string `json:"alpn,omitempty"`
|
Alpn []string `json:"alpn,omitempty"`
|
||||||
PinnedPeerCertificateChainSha256 string `json:"pinnedPeerCertificateChainSha256,omitempty"`
|
PinnedPeerCertificateChainSha256 string `json:"pinnedPeerCertificateChainSha256,omitempty"`
|
||||||
Certificates []Certificate `json:"certificates,omitempty"`
|
Certificates []Certificate `json:"certificates,omitempty"`
|
||||||
|
Fingerprint string `json:"fingerprint,omitempty"`
|
||||||
}
|
}
|
||||||
type Certificate struct {
|
type Certificate struct {
|
||||||
CertificateFile string `json:"certificateFile"`
|
CertificateFile string `json:"certificateFile"`
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package serverObj
|
package serverObj
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/v2rayA/v2rayA/core/coreObj"
|
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/v2rayA/v2rayA/core/coreObj"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -42,11 +43,11 @@ func NewHTTP(link string) (ServerObj, error) {
|
|||||||
func ParseHttpURL(u string) (data *HTTP, err error) {
|
func ParseHttpURL(u string) (data *HTTP, err error) {
|
||||||
t, err := url.Parse(u)
|
t, err := url.Parse(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, InvalidParameterErr
|
return nil, ErrInvalidParameter
|
||||||
}
|
}
|
||||||
port, err := strconv.Atoi(t.Port())
|
port, err := strconv.Atoi(t.Port())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, InvalidParameterErr
|
return nil, ErrInvalidParameter
|
||||||
}
|
}
|
||||||
data = &HTTP{
|
data = &HTTP{
|
||||||
Name: t.Fragment,
|
Name: t.Fragment,
|
||||||
|
@ -2,13 +2,14 @@ package serverObj
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/v2rayA/v2rayA/common"
|
|
||||||
"github.com/v2rayA/v2rayA/pkg/util/log"
|
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/v2rayA/v2rayA/common"
|
||||||
|
"github.com/v2rayA/v2rayA/pkg/util/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -35,7 +36,7 @@ func NewPingTunnel(link string) (ServerObj, error) {
|
|||||||
} else if strings.HasPrefix(link, "ping-tunnel://") {
|
} else if strings.HasPrefix(link, "ping-tunnel://") {
|
||||||
return ParsePingTunnelURL2(link)
|
return ParsePingTunnelURL2(link)
|
||||||
}
|
}
|
||||||
return nil, InvalidParameterErr
|
return nil, ErrInvalidParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParsePingTunnelURL1(u string) (data *PingTunnel, err error) {
|
func ParsePingTunnelURL1(u string) (data *PingTunnel, err error) {
|
||||||
|
@ -2,13 +2,14 @@ package serverObj
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/v2rayA/v2rayA/conf"
|
"github.com/v2rayA/v2rayA/conf"
|
||||||
"github.com/v2rayA/v2rayA/core/coreObj"
|
"github.com/v2rayA/v2rayA/core/coreObj"
|
||||||
"github.com/v2rayA/v2rayA/core/v2ray/where"
|
"github.com/v2rayA/v2rayA/core/v2ray/where"
|
||||||
"net/url"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var InvalidParameterErr = fmt.Errorf("invalid parameters")
|
var ErrInvalidParameter = fmt.Errorf("invalid parameters")
|
||||||
|
|
||||||
type ServerObj interface {
|
type ServerObj interface {
|
||||||
Configuration(info PriorInfo) (c Configuration, err error)
|
Configuration(info PriorInfo) (c Configuration, err error)
|
||||||
|
@ -3,12 +3,13 @@ package serverObj
|
|||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/v2rayA/v2rayA/common"
|
|
||||||
"github.com/v2rayA/v2rayA/core/coreObj"
|
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/v2rayA/v2rayA/common"
|
||||||
|
"github.com/v2rayA/v2rayA/core/coreObj"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -101,7 +102,7 @@ func ParseSSURL(u string) (data *Shadowsocks, err error) {
|
|||||||
v, ok = parse(t)
|
v, ok = parse(t)
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("%w: unrecognized ss address", InvalidParameterErr)
|
return nil, fmt.Errorf("%w: unrecognized ss address", ErrInvalidParameter)
|
||||||
}
|
}
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
@ -234,8 +235,8 @@ func (s *Shadowsocks) ConfigurationMT(info PriorInfo) (c Configuration, err erro
|
|||||||
Type: "http",
|
Type: "http",
|
||||||
Request: coreObj.HTTPRequest{
|
Request: coreObj.HTTPRequest{
|
||||||
Version: "1.1",
|
Version: "1.1",
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: strings.Split(path, ","),
|
Path: strings.Split(path, ","),
|
||||||
Headers: coreObj.HTTPReqHeader{
|
Headers: coreObj.HTTPReqHeader{
|
||||||
Host: strings.Split(host, ","),
|
Host: strings.Split(host, ","),
|
||||||
UserAgent: []string{
|
UserAgent: []string{
|
||||||
@ -243,19 +244,19 @@ func (s *Shadowsocks) ConfigurationMT(info PriorInfo) (c Configuration, err erro
|
|||||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.46",
|
"Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.46",
|
||||||
},
|
},
|
||||||
AcceptEncoding: []string{"gzip, deflate"},
|
AcceptEncoding: []string{"gzip, deflate"},
|
||||||
Connection: []string{"keep-alive"},
|
Connection: []string{"keep-alive"},
|
||||||
Pragma: "no-cache",
|
Pragma: "no-cache",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Response: coreObj.HTTPResponse{
|
Response: coreObj.HTTPResponse{
|
||||||
Version: "1.1",
|
Version: "1.1",
|
||||||
Status: "200",
|
Status: "200",
|
||||||
Reason: "OK",
|
Reason: "OK",
|
||||||
Headers: coreObj.HTTPRespHeader {
|
Headers: coreObj.HTTPRespHeader{
|
||||||
ContentType: []string{"application/octet-stream", "video/mpeg"},
|
ContentType: []string{"application/octet-stream", "video/mpeg"},
|
||||||
TransferEncoding: []string{"chunked"},
|
TransferEncoding: []string{"chunked"},
|
||||||
Connection: []string{"keep-alive"},
|
Connection: []string{"keep-alive"},
|
||||||
Pragma: "no-cache",
|
Pragma: "no-cache",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -289,7 +290,7 @@ func (s *Shadowsocks) ConfigurationMT(info PriorInfo) (c Configuration, err erro
|
|||||||
v2StreamSettings.TLSSettings.ServerName = host
|
v2StreamSettings.TLSSettings.ServerName = host
|
||||||
}
|
}
|
||||||
v2Mux = &coreObj.Mux{
|
v2Mux = &coreObj.Mux{
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
Concurrency: 1,
|
Concurrency: 1,
|
||||||
}
|
}
|
||||||
switch s.Plugin.Opts.Obfs {
|
switch s.Plugin.Opts.Obfs {
|
||||||
@ -318,9 +319,9 @@ func (s *Shadowsocks) ConfigurationMT(info PriorInfo) (c Configuration, err erro
|
|||||||
Servers: []coreObj.Server{v2rayServer},
|
Servers: []coreObj.Server{v2rayServer},
|
||||||
},
|
},
|
||||||
StreamSettings: v2StreamSettings,
|
StreamSettings: v2StreamSettings,
|
||||||
Mux: v2Mux,
|
Mux: v2Mux,
|
||||||
},
|
},
|
||||||
UDPSupport: udpSupport,
|
UDPSupport: udpSupport,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,12 @@ package serverObj
|
|||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/v2rayA/v2rayA/common"
|
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/v2rayA/v2rayA/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -102,7 +103,7 @@ func ParseSSRURL(u string) (data *ShadowsocksR, err error) {
|
|||||||
info, ok = parse(content)
|
info, ok = parse(content)
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
err = fmt.Errorf("%w: unrecognized ssr address", InvalidParameterErr)
|
err = fmt.Errorf("%w: unrecognized ssr address", ErrInvalidParameter)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return &info, nil
|
return &info, nil
|
||||||
|
@ -31,11 +31,11 @@ func NewSOCKS(link string) (ServerObj, error) {
|
|||||||
func ParseSocksURL(u string) (data *SOCKS, err error) {
|
func ParseSocksURL(u string) (data *SOCKS, err error) {
|
||||||
t, err := url.Parse(u)
|
t, err := url.Parse(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, InvalidParameterErr
|
return nil, ErrInvalidParameter
|
||||||
}
|
}
|
||||||
port, err := strconv.Atoi(t.Port())
|
port, err := strconv.Atoi(t.Port())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, InvalidParameterErr
|
return nil, ErrInvalidParameter
|
||||||
}
|
}
|
||||||
data = &SOCKS{
|
data = &SOCKS{
|
||||||
Name: t.Fragment,
|
Name: t.Fragment,
|
||||||
|
@ -2,12 +2,13 @@ package serverObj
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/v2rayA/v2rayA/common"
|
|
||||||
"github.com/v2rayA/v2rayA/core/coreObj"
|
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/v2rayA/v2rayA/common"
|
||||||
|
"github.com/v2rayA/v2rayA/core/coreObj"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -56,7 +57,7 @@ func ParseTrojanURL(u string) (data *Trojan, err error) {
|
|||||||
}
|
}
|
||||||
port, err := strconv.Atoi(t.Port())
|
port, err := strconv.Atoi(t.Port())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, InvalidParameterErr
|
return nil, ErrInvalidParameter
|
||||||
}
|
}
|
||||||
data = &Trojan{
|
data = &Trojan{
|
||||||
Name: t.Fragment,
|
Name: t.Fragment,
|
||||||
|
@ -43,6 +43,7 @@ type V2Ray struct {
|
|||||||
SNI string `json:"sni,omitempty"`
|
SNI string `json:"sni,omitempty"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
TLS string `json:"tls"`
|
TLS string `json:"tls"`
|
||||||
|
Fingerprint string `json:"fingerprint,omitempty"`
|
||||||
Flow string `json:"flow,omitempty"`
|
Flow string `json:"flow,omitempty"`
|
||||||
Alpn string `json:"alpn,omitempty"`
|
Alpn string `json:"alpn,omitempty"`
|
||||||
AllowInsecure bool `json:"allowInsecure"`
|
AllowInsecure bool `json:"allowInsecure"`
|
||||||
@ -56,7 +57,7 @@ func NewV2Ray(link string) (ServerObj, error) {
|
|||||||
} else if strings.HasPrefix(link, "vless://") {
|
} else if strings.HasPrefix(link, "vless://") {
|
||||||
return ParseVlessURL(link)
|
return ParseVlessURL(link)
|
||||||
}
|
}
|
||||||
return nil, InvalidParameterErr
|
return nil, ErrInvalidParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseVlessURL(vless string) (data *V2Ray, err error) {
|
func ParseVlessURL(vless string) (data *V2Ray, err error) {
|
||||||
@ -69,13 +70,14 @@ func ParseVlessURL(vless string) (data *V2Ray, err error) {
|
|||||||
Add: u.Hostname(),
|
Add: u.Hostname(),
|
||||||
Port: u.Port(),
|
Port: u.Port(),
|
||||||
ID: u.User.String(),
|
ID: u.User.String(),
|
||||||
|
Flow: u.Query().Get("flow"),
|
||||||
Net: u.Query().Get("type"),
|
Net: u.Query().Get("type"),
|
||||||
Type: u.Query().Get("headerType"),
|
Type: u.Query().Get("headerType"),
|
||||||
Host: u.Query().Get("host"),
|
Host: u.Query().Get("host"),
|
||||||
SNI: u.Query().Get("sni"),
|
SNI: u.Query().Get("sni"),
|
||||||
Path: u.Query().Get("path"),
|
Path: u.Query().Get("path"),
|
||||||
TLS: u.Query().Get("security"),
|
TLS: u.Query().Get("security"),
|
||||||
Flow: u.Query().Get("flow"),
|
Fingerprint: u.Query().Get("fp"),
|
||||||
Alpn: u.Query().Get("alpn"),
|
Alpn: u.Query().Get("alpn"),
|
||||||
AllowInsecure: u.Query().Get("allowInsecure") == "true",
|
AllowInsecure: u.Query().Get("allowInsecure") == "true",
|
||||||
Protocol: "vless",
|
Protocol: "vless",
|
||||||
@ -119,7 +121,7 @@ func ParseVmessURL(vmess string) (data *V2Ray, err error) {
|
|||||||
s := strings.Split(vmess[8:], "?")[0]
|
s := strings.Split(vmess[8:], "?")[0]
|
||||||
s, err = common.Base64StdDecode(s)
|
s, err = common.Base64StdDecode(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s, err = common.Base64URLDecode(s)
|
s, _ = common.Base64URLDecode(s)
|
||||||
}
|
}
|
||||||
subMatch := re.FindStringSubmatch(s)
|
subMatch := re.FindStringSubmatch(s)
|
||||||
if subMatch == nil {
|
if subMatch == nil {
|
||||||
@ -245,10 +247,9 @@ func (v *V2Ray) Configuration(info PriorInfo) (c Configuration, err error) {
|
|||||||
Port: port,
|
Port: port,
|
||||||
Users: []coreObj.User{
|
Users: []coreObj.User{
|
||||||
{
|
{
|
||||||
Encryption: "none",
|
|
||||||
ID: id,
|
ID: id,
|
||||||
Level: 8,
|
Encryption: "none",
|
||||||
Security: security,
|
Flow: v.Flow,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -370,19 +371,21 @@ func (v *V2Ray) Configuration(info PriorInfo) (c Configuration, err error) {
|
|||||||
}
|
}
|
||||||
core.StreamSettings.TLSSettings.Alpn = alpn
|
core.StreamSettings.TLSSettings.Alpn = alpn
|
||||||
}
|
}
|
||||||
|
// uTLS fingerprint
|
||||||
|
core.StreamSettings.TLSSettings.Fingerprint = v.Fingerprint
|
||||||
} else if strings.ToLower(v.TLS) == "xtls" {
|
} else if strings.ToLower(v.TLS) == "xtls" {
|
||||||
core.StreamSettings.Security = "xtls"
|
core.StreamSettings.Security = "xtls"
|
||||||
core.StreamSettings.XTLSSettings = &coreObj.TLSSettings{}
|
core.StreamSettings.XTLSSettings = &coreObj.TLSSettings{}
|
||||||
|
// SNI
|
||||||
|
if v.Host != "" {
|
||||||
|
core.StreamSettings.TLSSettings.ServerName = v.Host
|
||||||
|
}
|
||||||
if v.AllowInsecure {
|
if v.AllowInsecure {
|
||||||
core.StreamSettings.XTLSSettings.AllowInsecure = true
|
core.StreamSettings.XTLSSettings.AllowInsecure = true
|
||||||
}
|
}
|
||||||
// SNI
|
if v.Flow == "" {
|
||||||
if v.Host != "" {
|
v.Flow = "xtls-rprx-origin"
|
||||||
core.StreamSettings.XTLSSettings.ServerName = v.Host
|
|
||||||
} else if v.Host != "" {
|
|
||||||
core.StreamSettings.TLSSettings.ServerName = v.Host
|
|
||||||
}
|
}
|
||||||
// Alpn
|
|
||||||
if v.Alpn != "" {
|
if v.Alpn != "" {
|
||||||
alpn := strings.Split(v.Alpn, ",")
|
alpn := strings.Split(v.Alpn, ",")
|
||||||
for i := range alpn {
|
for i := range alpn {
|
||||||
@ -428,12 +431,11 @@ func (v *V2Ray) ExportToURL() string {
|
|||||||
setValue(&query, "serviceName", v.Path)
|
setValue(&query, "serviceName", v.Path)
|
||||||
}
|
}
|
||||||
if v.TLS != "none" {
|
if v.TLS != "none" {
|
||||||
|
setValue(&query, "flow", v.Flow)
|
||||||
setValue(&query, "sni", v.SNI)
|
setValue(&query, "sni", v.SNI)
|
||||||
setValue(&query, "alpn", v.Alpn)
|
setValue(&query, "alpn", v.Alpn)
|
||||||
setValue(&query, "allowInsecure", strconv.FormatBool(v.AllowInsecure))
|
setValue(&query, "allowInsecure", strconv.FormatBool(v.AllowInsecure))
|
||||||
}
|
setValue(&query, "fp", v.Fingerprint)
|
||||||
if v.TLS == "xtls" {
|
|
||||||
setValue(&query, "flow", v.Flow)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
U := url.URL{
|
U := url.URL{
|
||||||
|
Loading…
Reference in New Issue
Block a user