Skip to content

Commit

Permalink
Fix TCP IP version selection when conn is LOCAL.
Browse files Browse the repository at this point in the history
  • Loading branch information
kzemek committed Feb 26, 2021
1 parent c9e485d commit e6156cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ func tcpHandleConnection(conn net.Conn, logger *zap.Logger) {
}

targetAddr := Opts.TargetAddr6
if AddrVersion(saddr) == 4 {
if saddr == nil {
if AddrVersion(conn.RemoteAddr()) == 4 {
targetAddr = Opts.TargetAddr4
}
} else if AddrVersion(saddr) == 4 {
targetAddr = Opts.TargetAddr4
}

Expand Down

0 comments on commit e6156cb

Please sign in to comment.