continued work on encryption
This commit is contained in:
parent
4e1d5b36b2
commit
880e2f06b3
14 changed files with 362 additions and 39 deletions
|
|
@ -51,7 +51,7 @@ type FS struct {
|
|||
keepalive bool
|
||||
}
|
||||
|
||||
func NewFS(u *url.URL, log logr.Logger) (fs *FS, err error) {
|
||||
func NewFS(u *url.URL, block bool, log logr.Logger) (fs *FS, err error) {
|
||||
cfg, err := sshConfig(u)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
@ -66,6 +66,14 @@ func NewFS(u *url.URL, log logr.Logger) (fs *FS, err error) {
|
|||
ctx, cancel := context.WithCancel(context.Background())
|
||||
fs.cancel = cancel
|
||||
go fs.connect(ctx)
|
||||
if block {
|
||||
for {
|
||||
if _, e := fs.Stat("."); e != ErrNotConnected {
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +103,12 @@ func (fs *FS) connect(ctx context.Context) {
|
|||
go fs.keepAlive(ctx)
|
||||
fs.keepalive = true
|
||||
}
|
||||
fs.client, err = sftp.NewClient(fs.c, sftp.UseFstat(true))
|
||||
fs.client, err = sftp.NewClient(fs.c,
|
||||
sftp.UseFstat(true),
|
||||
sftp.UseConcurrentReads(true),
|
||||
//sftp.UseConcurrentWrites(true),
|
||||
//sftp.MaxPacket(23552),
|
||||
)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue