proxy: record failures of remote connection only

This commit is contained in:
nadoo committed 2020-09-14 20:56:37 +08:00
1 parent b3b11b4188
commit 89114e678b
7 files changed
+33 -15

No files matched your search

+6 -2
View File
@@ -6,6 +6,7 @@ import (
"io"
"net"
"net/textproto"
"strings"
"time"
"github.com/nadoo/glider/common/conn"
@@ -103,8 +104,11 @@ func (s *HTTP) servHTTPS(r *request, c net.Conn) {
log.F("[http] %s <-> %s [c] via %s", c.RemoteAddr(), r.uri, dialer.Addr())
if err = conn.Relay(c, rc); err != nil {
log.F("[http] relay error: %v", err)
s.proxy.Record(dialer, false)
log.F("[http] %s <-> %s via %s, relay error: %v", c.RemoteAddr(), r.uri, dialer.Addr(), err)
// record remote conn failure only
if !strings.Contains(err.Error(), s.addr) {
s.proxy.Record(dialer, false)
}
}
}