|
|
@@ -236,13 +236,23 @@ func warnSNIMismatch(conf *config.Config, ntw mtglib.Network, log mtglib.Logger)
|
|
236
|
236
|
return
|
|
237
|
237
|
}
|
|
238
|
238
|
|
|
|
239
|
+ v4Match := ourIP4 == nil
|
|
|
240
|
+ v6Match := ourIP6 == nil
|
|
|
241
|
+
|
|
239
|
242
|
for _, addr := range addresses {
|
|
240
|
|
- if (ourIP4 != nil && addr.IP.String() == ourIP4.String()) ||
|
|
241
|
|
- (ourIP6 != nil && addr.IP.String() == ourIP6.String()) {
|
|
242
|
|
- return
|
|
|
243
|
+ if ourIP4 != nil && addr.IP.String() == ourIP4.String() {
|
|
|
244
|
+ v4Match = true
|
|
|
245
|
+ }
|
|
|
246
|
+
|
|
|
247
|
+ if ourIP6 != nil && addr.IP.String() == ourIP6.String() {
|
|
|
248
|
+ v6Match = true
|
|
243
|
249
|
}
|
|
244
|
250
|
}
|
|
245
|
251
|
|
|
|
252
|
+ if v4Match && v6Match {
|
|
|
253
|
+ return
|
|
|
254
|
+ }
|
|
|
255
|
+
|
|
246
|
256
|
resolved := make([]string, 0, len(addresses))
|
|
247
|
257
|
for _, addr := range addresses {
|
|
248
|
258
|
resolved = append(resolved, addr.IP.String())
|
|
|
@@ -261,11 +271,20 @@ func warnSNIMismatch(conf *config.Config, ntw mtglib.Network, log mtglib.Logger)
|
|
261
|
271
|
our += ourIP6.String()
|
|
262
|
272
|
}
|
|
263
|
273
|
|
|
264
|
|
- log.BindStr("hostname", host).
|
|
|
274
|
+ entry := log.BindStr("hostname", host).
|
|
265
|
275
|
BindStr("resolved", strings.Join(resolved, ", ")).
|
|
266
|
|
- BindStr("public_ip", our).
|
|
267
|
|
- Warning("SNI-DNS mismatch: secret hostname does not resolve to this server's public IP. " +
|
|
268
|
|
- "DPI may detect and block the proxy. See 'mtg doctor' for details")
|
|
|
276
|
+ BindStr("public_ip", our)
|
|
|
277
|
+
|
|
|
278
|
+ if ourIP4 != nil {
|
|
|
279
|
+ entry = entry.BindStr("ipv4_match", fmt.Sprintf("%t", v4Match))
|
|
|
280
|
+ }
|
|
|
281
|
+
|
|
|
282
|
+ if ourIP6 != nil {
|
|
|
283
|
+ entry = entry.BindStr("ipv6_match", fmt.Sprintf("%t", v6Match))
|
|
|
284
|
+ }
|
|
|
285
|
+
|
|
|
286
|
+ entry.Warning("SNI-DNS mismatch: secret hostname does not resolve to this server's public IP. " +
|
|
|
287
|
+ "DPI may detect and block the proxy. See 'mtg doctor' for details")
|
|
269
|
288
|
}
|
|
270
|
289
|
|
|
271
|
290
|
func runProxy(conf *config.Config, version string) error { //nolint: funlen, cyclop
|