Skip to content

Commit e6156cb

Browse files
committed
Fix TCP IP version selection when conn is LOCAL.
1 parent c9e485d commit e6156cb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tcp.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ func tcpHandleConnection(conn net.Conn, logger *zap.Logger) {
5151
}
5252

5353
targetAddr := Opts.TargetAddr6
54-
if AddrVersion(saddr) == 4 {
54+
if saddr == nil {
55+
if AddrVersion(conn.RemoteAddr()) == 4 {
56+
targetAddr = Opts.TargetAddr4
57+
}
58+
} else if AddrVersion(saddr) == 4 {
5559
targetAddr = Opts.TargetAddr4
5660
}
5761

0 commit comments

Comments
 (0)