This commit is contained in:
2025-05-15 00:46:57 +02:00
parent 30c71cb449
commit b2b27b2c3d
18 changed files with 622 additions and 234 deletions

View File

@@ -1,32 +0,0 @@
package ssh
import (
"cloudsave/pkg/remote"
"fmt"
"log"
"os/user"
)
type (
SFTPSyncer struct {
}
)
func (SFTPSyncer) Sync(r remote.Remote) error {
currentUser, err := user.Current()
if err != nil {
log.Fatalf("Failed to get current user: %v", err)
}
cli, err := remote.ConnectWithKey(r.URL, currentUser.Username)
if err != nil {
cli, err = remote.ConnectWithPassword(r.URL, currentUser.Username)
if err != nil {
return fmt.Errorf("failed to connect to host: %w", err)
}
}
defer cli.Close()
return nil
}