continued work on encryption

This commit is contained in:
ston1th 2022-04-07 00:54:13 +02:00
commit 880e2f06b3
14 changed files with 362 additions and 39 deletions

View file

@ -32,7 +32,7 @@ type FS struct {
ph *PreloadHandler
}
func NewFS(quota int64, max int, src, srckey, dst, dstkey, metadata string, log logr.Logger) (fs *FS, err error) {
func NewFS(quota int64, max int, src, srckey, dst, dstkey, metadata string, block bool, log logr.Logger) (fs *FS, err error) {
if src == dst {
return nil, errors.New("src and dst path can not be equal")
}
@ -42,18 +42,20 @@ func NewFS(quota int64, max int, src, srckey, dst, dstkey, metadata string, log
if err != nil {
return nil, fmt.Errorf("srckey: %w", err)
}
log.V(2).Info("using source encryption")
}
if dstkey != "" {
dstk, err = hex.DecodeString(dstkey)
if err != nil {
return nil, fmt.Errorf("dstkey: %w", err)
}
log.V(2).Info("using destination encryption")
}
srcfs, err := parse.FS(src, srck)
srcfs, err := parse.FS(src, srck, block)
if err != nil {
return nil, fmt.Errorf("srcfs: %w", err)
}
dstfs, err := parse.FS(dst, dstk)
dstfs, err := parse.FS(dst, dstk, block)
if err != nil {
return nil, fmt.Errorf("dstfs: %w", err)
}