File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 44package portfwdserver
55
66import (
7+ "context"
78 "errors"
89 "io"
910 "net"
1011 "time"
1112
12- "github.com/lima-vm/lima/pkg/bicopy"
13+ "github.com/containers/gvisor-tap-vsock/pkg/tcpproxy"
14+
1315 "github.com/lima-vm/lima/pkg/guestagent/api"
1416)
1517
@@ -29,13 +31,13 @@ func (s *TunnelServer) Start(stream api.GuestService_TunnelServer) error {
2931 return err
3032 }
3133
32- // We simply forward data form GRPC stream to net.Conn for both tcp and udp. So simple proxy is sufficient
33- conn , err := net .Dial (in .Protocol , in .GuestAddr )
34- if err != nil {
35- return err
36- }
3734 rw := & GRPCServerRW {stream : stream , id : in .Id }
38- bicopy .Bicopy (rw , conn , nil )
35+ proxy := tcpproxy.DialProxy {DialContext : func (ctx context.Context , _ , _ string ) (net.Conn , error ) {
36+ // We simply forward data form GRPC stream to net.Conn for both tcp and udp. So simple proxy is sufficient
37+ var d net.Dialer
38+ return d .DialContext (ctx , in .Protocol , in .GuestAddr )
39+ }}
40+ proxy .HandleConn (rw )
3941 return nil
4042}
4143
You can’t perform that action at this time.
0 commit comments