redir: avoid local loop request

This commit is contained in:
nadoo committed 2019-03-04 19:19:00 +08:00
1 parent 9bcc18a29b
commit 19acda9ee0
3 files changed
+16 -32

No files matched your search

+6
View File
@@ -98,6 +98,12 @@ func (s *RedirProxy) Serve(c net.Conn) {
return
}
// loop request
if c.LocalAddr().String() == tgt.String() {
log.F("[redir] loop request detected")
return
}
rc, err := s.dialer.Dial("tcp", tgt.String())
if err != nil {
log.F("[redir] failed to connect to target: %v", err)