Working SMB file share

This commit is contained in:
AlexSSD7 2023-08-26 16:26:35 +01:00
commit 76b20570ec
11 changed files with 187 additions and 7 deletions

View file

@ -19,6 +19,7 @@ import (
"log/slog"
"github.com/alessio/shellescape"
"github.com/bramvdbogaerde/go-scp"
"github.com/phayes/freeport"
"github.com/pkg/errors"
"go.uber.org/multierr"
@ -330,6 +331,20 @@ func (vi *Instance) DialSSH() (*ssh.Client, error) {
return ssh.Dial("tcp", "localhost:"+fmt.Sprint(vi.sshMappedPort), vi.sshConf)
}
func (vi *Instance) DialSCP() (*scp.Client, error) {
if vi.sshConf == nil {
return nil, ErrSSHUnavailable
}
sc := scp.NewClient("localhost:"+fmt.Sprint(vi.sshMappedPort), vi.sshConf)
err := sc.Connect()
if err != nil {
return nil, err
}
return &sc, nil
}
func (vi *Instance) SSHUpNotifyChan() chan struct{} {
return vi.sshReadyCh
}