Skip to content

Commit 7b94043

Browse files
committed
Fix tunneling of connection when keepalive is set
Signed-off-by: Balaji Vijayakumar <[email protected]>
1 parent 8b30287 commit 7b94043

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/portfwd/client.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import (
1010
"time"
1111

1212
"github.com/containers/gvisor-tap-vsock/pkg/services/forwarder"
13-
"github.com/sirupsen/logrus"
14-
15-
"github.com/lima-vm/lima/pkg/bicopy"
13+
"github.com/containers/gvisor-tap-vsock/pkg/tcpproxy"
1614
"github.com/lima-vm/lima/pkg/guestagent/api"
1715
guestagentclient "github.com/lima-vm/lima/pkg/guestagent/api/client"
16+
"github.com/sirupsen/logrus"
1817
)
1918

2019
func HandleTCPConnection(ctx context.Context, client *guestagentclient.GuestAgentClient, conn net.Conn, guestAddr string) {
@@ -33,7 +32,10 @@ func HandleTCPConnection(ctx context.Context, client *guestagentclient.GuestAgen
3332
}
3433

3534
rw := &GrpcClientRW{stream: stream, id: id, addr: guestAddr, protocol: "tcp"}
36-
bicopy.Bicopy(rw, conn, nil)
35+
proxy := tcpproxy.DialProxy{DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
36+
return conn, nil
37+
}}
38+
proxy.HandleConn(rw)
3739
}
3840

3941
func HandleUDPConnection(ctx context.Context, client *guestagentclient.GuestAgentClient, conn net.PacketConn, guestAddr string) {

0 commit comments

Comments
 (0)