"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
crypt: Add --crypt-show-mapping to show encrypted file mapping
Nick Craig-Wood390f3cf35b2c
diff --git a/crypt/crypt.go b/crypt/crypt.goindex 92fd1f96b..07d05318b 100644--- a/crypt/crypt.go+++ b/crypt/crypt.go@@ -12,6 +12,12 @@ import ("github.com/pkg/errors")+// Globals+var (+ // Flags+ cryptShowMapping = fs.BoolP("crypt-show-mapping", "", false, "For all files listed show how the names encrypt.")+)+// Register with Fsfunc init() {fs.Register(&fs.RegInfo{@@ -485,11 +491,14 @@ func (lo *ListOpts) Level() int {// Multiple goroutines can safely add objects concurrently.func (lo *ListOpts) Add(obj fs.Object) (abort bool) {remote := obj.Remote()- _, err := lo.f.cipher.DecryptFileName(remote)+ decryptedRemote, err := lo.f.cipher.DecryptFileName(remote)if err != nil {fs.Debug(remote, "Skipping undecryptable file name: %v", err)return lo.ListOpts.IsFinished()}+ if *cryptShowMapping {+ fs.Log(decryptedRemote, "Encrypts to %q", remote)+ }return lo.ListOpts.Add(lo.f.newObject(obj))}@@ -498,11 +507,14 @@ func (lo *ListOpts) Add(obj fs.Object) (abort bool) {// Multiple goroutines can safely add objects concurrently.func (lo *ListOpts) AddDir(dir *fs.Dir) (abort bool) {remote := dir.Name- _, err := lo.f.cipher.DecryptDirName(remote)+ decryptedRemote, err := lo.f.cipher.DecryptDirName(remote)if err != nil {fs.Debug(remote, "Skipping undecryptable dir name: %v", err)return lo.ListOpts.IsFinished()}+ if *cryptShowMapping {+ fs.Log(decryptedRemote, "Encrypts to %q", remote)+ }return lo.ListOpts.AddDir(lo.f.newDir(dir))}diff --git a/docs/content/crypt.md b/docs/content/crypt.mdindex 58aa6d9f1..8cf298cbb 100644--- a/docs/content/crypt.md+++ b/docs/content/crypt.md@@ -236,6 +236,21 @@ depends on that.Hashes are not stored for crypt. However the data integrity isprotected by an extremely strong crypto authenticator.+### Specific options ###++Here are the command line options specific to this cloud storage+system.++#### --crypt-show-mapping ####++If this flag is set then for each file that the remote is asked to+list, it will log (at level INFO) a line stating the decrypted file+name and the encrypted file name.++This is so you can work out which encrypted names are which decrypted+names just in case you need to do something with the encrypted file+names, or for debugging purposes.+## File formats ##### File encryption ###