add sniffing.fallback option for red handler

This commit is contained in:
ginuerzh
2024-09-04 22:44:05 +08:00
parent 31c482c649
commit e7581f0a9e
3 changed files with 6 additions and 6 deletions
+4
View File
@@ -241,6 +241,10 @@ func (h *redirectHandler) handleHTTPS(ctx context.Context, rw io.ReadWriter, rad
cc, err = h.options.Router.Dial(ctx, "tcp", host)
if err != nil {
log.Error(err)
if !h.md.sniffingFallback {
return err
}
}
}
+2
View File
@@ -11,11 +11,13 @@ type metadata struct {
tproxy bool
sniffing bool
sniffingTimeout time.Duration
sniffingFallback bool
}
func (h *redirectHandler) parseMetadata(md mdata.Metadata) (err error) {
h.md.tproxy = mdutil.GetBool(md, "tproxy")
h.md.sniffing = mdutil.GetBool(md, "sniffing")
h.md.sniffingTimeout = mdutil.GetDuration(md, "sniffing.timeout")
h.md.sniffingFallback = mdutil.GetBool(md, "sniffing.fallback")
return
}