@@ -943,7 +943,8 @@ func (c *Conn) DialContextUDP(ctx context.Context, ipp netip.AddrPort) (*gonet.U
943
943
return c .netStack .DialContextUDP (ctx ,ipp )
944
944
}
945
945
946
- func (c * Conn )forwardTCP (_ ,dst netip.AddrPort ) (handler func (net.Conn ),opts []tcpip.SettableSocketOption ,intercept bool ) {
946
+ func (c * Conn )forwardTCP (src ,dst netip.AddrPort ) (handler func (net.Conn ),opts []tcpip.SettableSocketOption ,intercept bool ) {
947
+ logger := c .logger .Named ("tcp" ).With (slog .F ("src" ,src .String ()),slog .F ("dst" ,dst .String ()))
947
948
c .mutex .Lock ()
948
949
ln ,ok := c .listeners [listenKey {"tcp" ,"" ,fmt .Sprint (dst .Port ())}]
949
950
c .mutex .Unlock ()
@@ -961,10 +962,14 @@ func (c *Conn) forwardTCP(_, dst netip.AddrPort) (handler func(net.Conn), opts [
961
962
defer t .Stop ()
962
963
select {
963
964
case ln .conn <- conn :
965
+ logger .Info (context .Background (),"accepted connection" )
964
966
return
965
967
case <- ln .closed :
968
+ logger .Info (context .Background (),"listener closed; closing connection" )
966
969
case <- c .closed :
970
+ logger .Info (context .Background (),"tailnet closed; closing connection" )
967
971
case <- t .C :
972
+ logger .Info (context .Background (),"listener timed out accepting; closing connection" )
968
973
}
969
974
_ = conn .Close ()
970
975
},opts ,true