added sftp client implementation

This commit is contained in:
ston1th 2022-04-02 20:05:07 +02:00
commit ce73f0472c
175 changed files with 28135 additions and 13 deletions

View file

@ -5,10 +5,13 @@ package parse
import (
"cachefs/pkg/provider"
"cachefs/pkg/provider/mount"
"cachefs/pkg/provider/sftp"
"errors"
"fmt"
neturl "net/url"
"path/filepath"
"k8s.io/klog/v2/klogr"
)
var (
@ -26,9 +29,9 @@ func FS(url string) (provider.FS, error) {
}
switch u.Scheme {
case "file":
return mount.NewFS(u.Path), nil
//case "sftp":
// return sftp.FS(u.Path), nil
return mount.NewFS(u.Path)
case "sftp":
return sftp.NewFS(u, klogr.New().WithName("sftp"))
}
return nil, fmt.Errorf("%w: %s", ErrUnsupportedScheme, u.Scheme)
}