OSDN Git Service

v2raya: backport upstream fixes
[v2raya/v2raya-openwrt.git] / v2raya / patches / 030-fix-incorrect-ipv6-routing.patch
1 From ce463911b8b480363cdf2b55518e4e7ac85ca6d7 Mon Sep 17 00:00:00 2001
2 From: mzz2017 <mzz@tuta.io>
3 Date: Thu, 16 Dec 2021 23:44:07 +0800
4 Subject: [PATCH] fix: incorrect ipv6 routing. #329
5
6 ---
7  service/core/v2ray/v2rayTmpl.go | 20 ++++++++++----------
8  1 file changed, 10 insertions(+), 10 deletions(-)
9
10 --- a/core/v2ray/v2rayTmpl.go
11 +++ b/core/v2ray/v2rayTmpl.go
12 @@ -516,7 +516,7 @@ func (t *Template) AppendRoutingRuleByMo
13                                 coreObj.RoutingRule{
14                                         Type:        "field",
15                                         OutboundTag: firstOutboundTag,
16 -                                       InboundTag:  inbounds,
17 +                                       InboundTag:  deepcopy.Copy(inbounds).([]string),
18                                         Domain:      []string{"ext:LoyalsoldierSite.dat:geolocation-!cn"},
19                                 })
20                 } else {
21 @@ -524,7 +524,7 @@ func (t *Template) AppendRoutingRuleByMo
22                                 coreObj.RoutingRule{
23                                         Type:        "field",
24                                         OutboundTag: firstOutboundTag,
25 -                                       InboundTag:  inbounds,
26 +                                       InboundTag:  deepcopy.Copy(inbounds).([]string),
27                                         Domain:      []string{"geosite:geolocation-!cn"},
28                                 })
29                 }
30 @@ -532,19 +532,19 @@ func (t *Template) AppendRoutingRuleByMo
31                         coreObj.RoutingRule{
32                                 Type:        "field",
33                                 OutboundTag: "direct",
34 -                               InboundTag:  inbounds,
35 +                               InboundTag:  deepcopy.Copy(inbounds).([]string),
36                                 Domain:      []string{"geosite:cn"},
37                         },
38                         coreObj.RoutingRule{
39                                 Type:        "field",
40                                 OutboundTag: "proxy",
41 -                               InboundTag:  inbounds,
42 +                               InboundTag:  deepcopy.Copy(inbounds).([]string),
43                                 IP:          []string{"geoip:hk", "geoip:mo"},
44                         },
45                         coreObj.RoutingRule{
46                                 Type:        "field",
47                                 OutboundTag: "direct",
48 -                               InboundTag:  inbounds,
49 +                               InboundTag:  deepcopy.Copy(inbounds).([]string),
50                                 IP:          []string{"geoip:private", "geoip:cn"},
51                         },
52                 )
53 @@ -554,13 +554,13 @@ func (t *Template) AppendRoutingRuleByMo
54                                 coreObj.RoutingRule{
55                                         Type:        "field",
56                                         OutboundTag: firstOutboundTag,
57 -                                       InboundTag:  inbounds,
58 +                                       InboundTag:  deepcopy.Copy(inbounds).([]string),
59                                         Domain:      []string{"ext:LoyalsoldierSite.dat:gfw"},
60                                 },
61                                 coreObj.RoutingRule{
62                                         Type:        "field",
63                                         OutboundTag: firstOutboundTag,
64 -                                       InboundTag:  inbounds,
65 +                                       InboundTag:  deepcopy.Copy(inbounds).([]string),
66                                         Domain:      []string{"ext:LoyalsoldierSite.dat:greatfire"},
67                                 })
68                 } else {
69 @@ -568,7 +568,7 @@ func (t *Template) AppendRoutingRuleByMo
70                                 coreObj.RoutingRule{
71                                         Type:        "field",
72                                         OutboundTag: firstOutboundTag,
73 -                                       InboundTag:  inbounds,
74 +                                       InboundTag:  deepcopy.Copy(inbounds).([]string),
75                                         Domain:      []string{"geosite:geolocation-!cn"},
76                                 })
77                 }
78 @@ -576,11 +576,11 @@ func (t *Template) AppendRoutingRuleByMo
79                         coreObj.RoutingRule{
80                                 Type:        "field",
81                                 OutboundTag: "direct",
82 -                               InboundTag:  inbounds,
83 +                               InboundTag:  deepcopy.Copy(inbounds).([]string),
84                         },
85                 )
86         case configure.RoutingAMode:
87 -               if err := parseRoutingA(t, inbounds); err != nil {
88 +               if err := parseRoutingA(t, deepcopy.Copy(inbounds).([]string)); err != nil {
89                         return err
90                 }
91         }