Skip to content

Commit 7b1c5b6

Browse files
committed
tcp,udp: m rename
1 parent 376545b commit 7b1c5b6

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

intra/tcp.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func (h *tcpHandler) Proxy(gconn *netstack.GTCPConn, src, target netip.AddrPort)
292292
}
293293

294294
// handle connects to the target via the proxy, and pipes data between the src, target; thread-safe.
295-
func (h *tcpHandler) handle(px ipn.Proxy, src *netstack.GTCPConn, boundSrc, target netip.AddrPort, errOnNoRoute bool, smm *SocketSummary) (cont bool, err error) {
295+
func (h *tcpHandler) handle(px ipn.Proxy, gconn *netstack.GTCPConn, boundSrc, target netip.AddrPort, errOnNoRoute bool, smm *SocketSummary) (cont bool, err error) {
296296
cont = true
297297
stop := !cont
298298
targetstr := target.String()
@@ -311,7 +311,7 @@ func (h *tcpHandler) handle(px ipn.Proxy, src *netstack.GTCPConn, boundSrc, targ
311311

312312
if settings.Debug {
313313
log.VV("tcp: %s dial %s: attempt: %s [%s] => %s for %s",
314-
smm.ID, pidstr(px), src.LocalAddr(), boundSrc, targetstr, smm.UID)
314+
smm.ID, pidstr(px), gconn.LocalAddr(), boundSrc, targetstr, smm.UID)
315315
}
316316

317317
// github.com/google/gvisor/blob/5ba35f516b5c2/test/benchmarks/tcp/tcp_proxy.go#L359
@@ -354,14 +354,14 @@ func (h *tcpHandler) handle(px ipn.Proxy, src *netstack.GTCPConn, boundSrc, targ
354354
return cont, err
355355
}
356356

357-
if _, synackerr := h.handshakeIfNeededOrClose(src, smm); synackerr != nil {
357+
if _, synackerr := h.handshakeIfNeededOrClose(gconn, smm); synackerr != nil {
358358
clos(pc)
359359
return stop, synackerr
360360
}
361361

362362
core.Go("tcp.forward."+smm.ID, func() {
363363
h.listener.PostFlow(smm.postMark())
364-
h.forward(src, rwext{dst, tcptimeout}, smm) // src always *gonet.TCPConn
364+
h.forward(gconn, rwext{dst, tcptimeout}, smm) // src always *gonet.TCPConn
365365
})
366366
return cont, nil // handled; takes ownership of src
367367
}

intra/udp.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ func (h *udpHandler) Connect(gconn *netstack.GUDPConn, src, target netip.AddrPor
361361

362362
var laddr net.Addr
363363
switch x := pc.(type) {
364+
case *net.UDPConn: // direct
365+
laddr = x.LocalAddr()
364366
case core.UDPConn: // connected
365367
laddr = x.LocalAddr()
366368
case net.Conn: // muxed

0 commit comments

Comments
 (0)