mirror of
https://github.com/restic/restic.git
synced 2025-10-27 05:59:46 +00:00
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/local"
|
||||
"github.com/restic/restic/backend/s3"
|
||||
"github.com/restic/restic/backend/sftp"
|
||||
"github.com/restic/restic/repository"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
@@ -127,6 +128,7 @@ func (o GlobalOptions) OpenRepository() (*repository.Repository, error) {
|
||||
// Open the backend specified by URI.
|
||||
// Valid formats are:
|
||||
// * /foo/bar -> local repository at /foo/bar
|
||||
// * s3://region/bucket -> amazon s3 bucket
|
||||
// * sftp://user@host/foo/bar -> remote sftp repository on host for user at path foo/bar
|
||||
// * sftp://host//tmp/backup -> remote sftp repository on host at path /tmp/backup
|
||||
func open(u string) (backend.Backend, error) {
|
||||
@@ -137,6 +139,8 @@ func open(u string) (backend.Backend, error) {
|
||||
|
||||
if url.Scheme == "" {
|
||||
return local.Open(url.Path)
|
||||
} else if url.Scheme == "s3" {
|
||||
return s3.Open(url.Host, url.Path[1:])
|
||||
}
|
||||
|
||||
args := []string{url.Host}
|
||||
@@ -158,6 +162,8 @@ func create(u string) (backend.Backend, error) {
|
||||
|
||||
if url.Scheme == "" {
|
||||
return local.Create(url.Path)
|
||||
} else if url.Scheme == "s3" {
|
||||
return s3.Open(url.Host, url.Path[1:])
|
||||
}
|
||||
|
||||
args := []string{url.Host}
|
||||
|
||||
Reference in New Issue
Block a user