File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
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"
1313 "github.com/lima-vm/lima/pkg/guestagent/api"
14+
15+ "github.com/containers/gvisor-tap-vsock/pkg/tcpproxy"
1416)
1517
1618type TunnelServer struct {}
@@ -30,12 +32,11 @@ func (s *TunnelServer) Start(stream api.GuestService_TunnelServer) error {
3032 }
3133
3234 // 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- }
3735 rw := & GRPCServerRW {stream : stream , id : in .Id }
38- bicopy .Bicopy (rw , conn , nil )
36+ proxy := tcpproxy.DialProxy {DialContext : func (_ context.Context , _ , _ string ) (net.Conn , error ) {
37+ return net .Dial (in .Protocol , in .GuestAddr )
38+ }}
39+ proxy .HandleConn (rw )
3940 return nil
4041}
4142
You can’t perform that action at this time.
0 commit comments