From f2371db2a9771cd2d7bda30678da9a895ef30e0b Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 27 Jan 2016 22:47:09 +0100 Subject: [PATCH] repository: remove decryptReadCloser --- repository/decrypt_read_closer.go | 36 ------------------------------- 1 file changed, 36 deletions(-) delete mode 100644 repository/decrypt_read_closer.go diff --git a/repository/decrypt_read_closer.go b/repository/decrypt_read_closer.go deleted file mode 100644 index 81a6f9513..000000000 --- a/repository/decrypt_read_closer.go +++ /dev/null @@ -1,36 +0,0 @@ -package repository - -import ( - "io" - - "github.com/restic/restic/crypto" -) - -// decryptReadCloser couples an underlying reader with a DecryptReader and -// implements io.ReadCloser. On Close(), both readers are closed. -type decryptReadCloser struct { - r io.ReadCloser - dr io.ReadCloser -} - -func newDecryptReadCloser(key *crypto.Key, rd io.ReadCloser) (io.ReadCloser, error) { - dr, err := crypto.DecryptFrom(key, rd) - if err != nil { - return nil, err - } - - return &decryptReadCloser{r: rd, dr: dr}, nil -} - -func (dr *decryptReadCloser) Read(buf []byte) (int, error) { - return dr.dr.Read(buf) -} - -func (dr *decryptReadCloser) Close() error { - err := dr.dr.Close() - if err != nil { - return err - } - - return dr.r.Close() -}