File tree 5 files changed +29
-8
lines changed
5 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,8 @@ Configuration file is "config.json" by default:
85
85
"Timeout" : 6 ,
86
86
"EDNSClientSubnet" : {
87
87
"Policy" : " disable" ,
88
- "ExternalIP" : " "
88
+ "ExternalIP" : " " ,
89
+ "NoCookie" : true
89
90
}
90
91
}
91
92
],
@@ -98,7 +99,8 @@ Configuration file is "config.json" by default:
98
99
"Timeout" : 6 ,
99
100
"EDNSClientSubnet" : {
100
101
"Policy" : " disable" ,
101
- "ExternalIP" : " "
102
+ "ExternalIP" : " " ,
103
+ "NoCookie" : true
102
104
}
103
105
}
104
106
],
@@ -135,6 +137,7 @@ IPv6). Overture will handle both TCP and UDP requests. Literal IPv6 addresses ar
135
137
+ ` manual ` : Use external IP if this field is not empty, otherwise use client IP if it is not reserved IP.
136
138
+ ` disable ` : Disable this feature.
137
139
+ ExternalIP: If this field is empty, ECS will be disabled when the inbound IP is not an external IP.
140
+ + NoCookie: Disable cookie.
138
141
+ OnlyPrimaryDNS: Disable dispatcher feature, use primary DNS only.
139
142
+ IPv6UseAlternativeDNS: Redirect IPv6 DNS queries to alternative DNS servers.
140
143
+ File: Absolute path like ` /path/to/file ` is allowed. For Windows users, please use properly escaped path like
Original file line number Diff line number Diff line change 9
9
"Timeout" : 6 ,
10
10
"EDNSClientSubnet" : {
11
11
"Policy" : " disable" ,
12
- "ExternalIP" : " "
12
+ "ExternalIP" : " " ,
13
+ "NoCookie" : true
13
14
}
14
15
}
15
16
],
22
23
"Timeout" : 6 ,
23
24
"EDNSClientSubnet" : {
24
25
"Policy" : " disable" ,
25
- "ExternalIP" : " "
26
+ "ExternalIP" : " " ,
27
+ "NoCookie" : true
26
28
}
27
29
}
28
30
],
Original file line number Diff line number Diff line change 9
9
"Timeout" : 6 ,
10
10
"EDNSClientSubnet" : {
11
11
"Policy" : " disable" ,
12
- "ExternalIP" : " "
12
+ "ExternalIP" : " " ,
13
+ "NoCookie" : true
13
14
}
14
15
}
15
16
],
22
23
"Timeout" : 6 ,
23
24
"EDNSClientSubnet" : {
24
25
"Policy" : " disable" ,
25
- "ExternalIP" : " "
26
+ "ExternalIP" : " " ,
27
+ "NoCookie" : true
26
28
}
27
29
}
28
30
],
Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ import (
9
9
type EDNSClientSubnetType struct {
10
10
Policy string
11
11
ExternalIP string
12
+ NoCookie bool
12
13
}
13
14
14
- func SetEDNSClientSubnet (m * dns.Msg , ip string ) {
15
+ func SetEDNSClientSubnet (m * dns.Msg , ip string , isNoCookie bool ) {
15
16
16
17
if ip == "" {
17
18
return
@@ -40,6 +41,19 @@ func SetEDNSClientSubnet(m *dns.Msg, ip string) {
40
41
}
41
42
es .SourceScope = 0
42
43
o .Option = append (o .Option , es )
44
+ if isNoCookie {
45
+ deleteCookie (o )
46
+ }
47
+ }
48
+ }
49
+
50
+ func deleteCookie (o * dns.OPT ) {
51
+
52
+ for i , e0 := range o .Option {
53
+ switch e0 .(type ) {
54
+ case * dns.EDNS0_COOKIE :
55
+ o .Option = append (o .Option [:i ], o .Option [i + 1 :]... )
56
+ }
43
57
}
44
58
}
45
59
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ func (c *Client) getEDNSClientSubnetIP() {
55
55
56
56
func (c * Client ) ExchangeFromRemote (isCache bool , isLog bool ) {
57
57
58
- common .SetEDNSClientSubnet (c .QuestionMessage , c .EDNSClientSubnetIP )
58
+ common .SetEDNSClientSubnet (c .QuestionMessage , c .EDNSClientSubnetIP , c . DNSUpstream . EDNSClientSubnet . NoCookie )
59
59
c .EDNSClientSubnetIP = common .GetEDNSClientSubnetIP (c .QuestionMessage )
60
60
61
61
var conn net.Conn
You can’t perform that action at this time.
0 commit comments