isc-dhcp: Update to 4.4.3-P1
[feed/packages.git] / net / v2raya / patches / 014-fix-seed-cannot-be-read-from-vless-sharing-link-and-add-m.patch
1 From 5db722b22b39642280572a62b149d4e1efa21ce3 Mon Sep 17 00:00:00 2001
2 From: mzz2017 <mzz@tuta.io>
3 Date: Mon, 8 Aug 2022 22:30:36 +0800
4 Subject: [PATCH] fix: seed cannot be read from vless sharing-link and add
5 missing sni field. #616
6
7 ---
8 service/core/serverObj/v2ray.go | 24 +++++++++++-------------
9 1 file changed, 11 insertions(+), 13 deletions(-)
10
11 --- a/core/serverObj/v2ray.go
12 +++ b/core/serverObj/v2ray.go
13 @@ -12,7 +12,6 @@ import (
14 "time"
15
16 jsoniter "github.com/json-iterator/go"
17 - "github.com/tidwall/gjson"
18 "github.com/v2rayA/v2rayA/common"
19 "github.com/v2rayA/v2rayA/core/coreObj"
20 "github.com/v2rayA/v2rayA/core/v2ray/service"
21 @@ -39,6 +38,7 @@ type V2Ray struct {
22 Net string `json:"net"`
23 Type string `json:"type"`
24 Host string `json:"host"`
25 + SNI string `json:"sni"`
26 Path string `json:"path"`
27 TLS string `json:"tls"`
28 Flow string `json:"flow,omitempty"`
29 @@ -69,7 +69,8 @@ func ParseVlessURL(vless string) (data *
30 ID: u.User.String(),
31 Net: u.Query().Get("type"),
32 Type: u.Query().Get("headerType"),
33 - Host: u.Query().Get("sni"),
34 + Host: u.Query().Get("host"),
35 + SNI: u.Query().Get("sni"),
36 Path: u.Query().Get("path"),
37 TLS: u.Query().Get("security"),
38 Flow: u.Query().Get("flow"),
39 @@ -86,16 +87,13 @@ func ParseVlessURL(vless string) (data *
40 if data.Type == "" {
41 data.Type = "none"
42 }
43 - if data.Host == "" {
44 - data.Host = u.Query().Get("host")
45 - }
46 if data.TLS == "" {
47 data.TLS = "none"
48 }
49 if data.Flow == "" {
50 data.Flow = "xtls-rprx-direct"
51 }
52 - if data.Type == "mkcp" || data.Type == "kcp" {
53 + if data.Net == "mkcp" || data.Net == "kcp" {
54 data.Path = u.Query().Get("seed")
55 }
56 return data, nil
57 @@ -145,6 +143,7 @@ func ParseVmessURL(vmess string) (data *
58 if aid == "" {
59 aid = q.Get("aid")
60 }
61 + sni := q.Get("sni")
62 info = V2Ray{
63 ID: subMatch[1],
64 Add: subMatch[2],
65 @@ -152,6 +151,7 @@ func ParseVmessURL(vmess string) (data *
66 Ps: ps,
67 Host: obfsParam,
68 Path: path,
69 + SNI: sni,
70 Net: obfs,
71 Aid: aid,
72 TLS: map[string]string{"1": "tls"}[q.Get("tls")],
73 @@ -165,12 +165,6 @@ func ParseVmessURL(vmess string) (data *
74 if err != nil {
75 return
76 }
77 - if info.Host == "" {
78 - sni := gjson.Get(raw, "sni")
79 - if sni.Exists() {
80 - info.Host = sni.String()
81 - }
82 - }
83 }
84 // correct the wrong vmess as much as possible
85 if strings.HasPrefix(info.Host, "/") && info.Path == "" {
86 @@ -328,7 +322,9 @@ func (v *V2Ray) Configuration(info Prior
87 core.StreamSettings.TLSSettings.AllowInsecure = true
88 }
89 // SNI
90 - if v.Host != "" {
91 + if v.SNI != "" {
92 + core.StreamSettings.TLSSettings.ServerName = v.SNI
93 + } else if v.Host != "" {
94 core.StreamSettings.TLSSettings.ServerName = v.Host
95 }
96 // Alpn
97 @@ -345,6 +341,8 @@ func (v *V2Ray) Configuration(info Prior
98 // SNI
99 if v.Host != "" {
100 core.StreamSettings.XTLSSettings.ServerName = v.Host
101 + } else if v.Host != "" {
102 + core.StreamSettings.TLSSettings.ServerName = v.Host
103 }
104 if v.AllowInsecure {
105 core.StreamSettings.XTLSSettings.AllowInsecure = true