66 "encoding/base64"
77 "encoding/json"
88 "fmt"
9- "io "
9+ "net "
1010 "os"
1111 "path/filepath"
1212 "strings"
@@ -23,15 +23,14 @@ import (
2323 "github.com/loft-sh/devpod/pkg/netstat"
2424 "github.com/loft-sh/devpod/pkg/platform"
2525 provider2 "github.com/loft-sh/devpod/pkg/provider"
26- "github.com/loft-sh/devpod/pkg/stdio"
2726 "github.com/loft-sh/log"
2827 "github.com/moby/patternmatcher/ignorefile"
2928 perrors "github.com/pkg/errors"
3029 "google.golang.org/grpc"
3130 "google.golang.org/grpc/reflection"
3231)
3332
34- func RunServicesServer (ctx context.Context , reader io. Reader , writer io. WriteCloser , allowGitCredentials , allowDockerCredentials bool , forwarder netstat.Forwarder , workspace * provider2.Workspace , log log.Logger , options ... Option ) error {
33+ func RunServicesServer (ctx context.Context , lis net. Listener , allowGitCredentials , allowDockerCredentials bool , forwarder netstat.Forwarder , workspace * provider2.Workspace , log log.Logger , options ... Option ) error {
3534 opts := append (options , []Option {
3635 WithForwarder (forwarder ),
3736 WithAllowGitCredentials (allowGitCredentials ),
@@ -40,21 +39,21 @@ func RunServicesServer(ctx context.Context, reader io.Reader, writer io.WriteClo
4039 }... )
4140 tunnelServ := New (log , opts ... )
4241
43- return tunnelServ .Run (ctx , reader , writer )
42+ return tunnelServ .Run (ctx , lis )
4443}
4544
46- func RunUpServer (ctx context.Context , reader io. Reader , writer io. WriteCloser , allowGitCredentials , allowDockerCredentials bool , workspace * provider2.Workspace , log log.Logger , options ... Option ) (* config.Result , error ) {
45+ func RunUpServer (ctx context.Context , lis net. Listener , allowGitCredentials , allowDockerCredentials bool , workspace * provider2.Workspace , log log.Logger , options ... Option ) (* config.Result , error ) {
4746 opts := append (options , []Option {
4847 WithWorkspace (workspace ),
4948 WithAllowGitCredentials (allowGitCredentials ),
5049 WithAllowDockerCredentials (allowDockerCredentials ),
5150 }... )
5251 tunnelServ := New (log , opts ... )
5352
54- return tunnelServ .RunWithResult (ctx , reader , writer )
53+ return tunnelServ .RunWithResult (ctx , lis )
5554}
5655
57- func RunSetupServer (ctx context.Context , reader io. Reader , writer io. WriteCloser , allowGitCredentials , allowDockerCredentials bool , mounts []* config.Mount , log log.Logger , options ... Option ) (* config.Result , error ) {
56+ func RunSetupServer (ctx context.Context , lis net. Listener , allowGitCredentials , allowDockerCredentials bool , mounts []* config.Mount , log log.Logger , options ... Option ) (* config.Result , error ) {
5857 opts := append (options , []Option {
5958 WithMounts (mounts ),
6059 WithAllowGitCredentials (allowGitCredentials ),
@@ -64,7 +63,7 @@ func RunSetupServer(ctx context.Context, reader io.Reader, writer io.WriteCloser
6463 tunnelServ := New (log , opts ... )
6564 tunnelServ .allowPlatformOptions = true
6665
67- return tunnelServ .RunWithResult (ctx , reader , writer )
66+ return tunnelServ .RunWithResult (ctx , lis )
6867}
6968
7069func New (log log.Logger , options ... Option ) * tunnelServer {
@@ -96,8 +95,7 @@ type tunnelServer struct {
9695 platformOptions * devpod.PlatformOptions
9796}
9897
99- func (t * tunnelServer ) RunWithResult (ctx context.Context , reader io.Reader , writer io.WriteCloser ) (* config.Result , error ) {
100- lis := stdio .NewStdioListener (reader , writer , false )
98+ func (t * tunnelServer ) RunWithResult (ctx context.Context , lis net.Listener ) (* config.Result , error ) {
10199 s := grpc .NewServer ()
102100 tunnel .RegisterTunnelServer (s , t )
103101 reflection .Register (s )
@@ -114,8 +112,8 @@ func (t *tunnelServer) RunWithResult(ctx context.Context, reader io.Reader, writ
114112 }
115113}
116114
117- func (t * tunnelServer ) Run (ctx context.Context , reader io. Reader , writer io. WriteCloser ) error {
118- _ , err := t .RunWithResult (ctx , reader , writer )
115+ func (t * tunnelServer ) Run (ctx context.Context , lis net. Listener ) error {
116+ _ , err := t .RunWithResult (ctx , lis )
119117 return err
120118}
121119
0 commit comments