pub async fn copy_s2p<'a, R, W>(method: CipherKind, reader: &'a mut R, writer: &'a mut W) -> io::Result<u64>
where
    R: AsyncRead + Unpin + ?Sized,
    W: AsyncWrite + Unpin + ?Sized,
{
    let buffer_length = match method.category() {
        CipherCategory::Stream | CipherCategory::None => {
            // Stream cipher uses 16K buffer
            1 << 14
        }
        CipherCategory::Aead => {
            // AEAD cipher have a maximum packet size 0x3FFF
            // Reserves some space for TAGS and length for AEAD
            super::aead::MAX_PACKET_SIZE + method.tag_len()
        }
    };

    Copy::new(reader, writer, buffer_length).await
}
/// Copy all data from encrypted `reader` to plain `writer`
Copy all data from encrypted `reader` to plain `writer`
Copy all data from encrypted ` reader ` to plain ` writer `
pub async fn copy_s2p<'a, R, W>(method: CipherKind, reader: &'a mut R, writer: &'a mut W) -> io::Result<u64>
where
    R: AsyncRead + Unpin + ?Sized,
    W: AsyncWrite + Unpin + ?Sized,
{
    let buffer_length = match method.category() {
        CipherCategory::Stream | CipherCategory::None => {
            // Stream cipher uses 16K buffer
            1 << 14
        }
        CipherCategory::Aead => {
            // AEAD cipher have a maximum packet size 0x3FFF
            // Reserves some space for TAGS and length for AEAD
            super::aead::MAX_PACKET_SIZE + method.tag_len()
        }
    };
    Copy::new(reader, writer, buffer_length).await
}
pub async fn copy_s2p < ' a , R , W > ( method : CipherKind , reader : & ' a mut R , writer : & ' a mut W ) -> io :: Result < u64 > where R : AsyncRead + Unpin + ? Sized , W : AsyncWrite + Unpin + ? Sized , { let buffer_length = match method . category ( ) { CipherCategory :: Stream | CipherCategory :: None => { // Stream cipher uses 16K buffer 1 << 14 } CipherCategory :: Aead => { // AEAD cipher have a maximum packet size 0x3FFF // Reserves some space for TAGS and length for AEAD super :: aead :: MAX_PACKET_SIZE + method . tag_len ( ) } } ; Copy :: new ( reader , writer , buffer_length ) . await }
Copy all data from encrypted `reader` to plain `writer`
Copy all data from encrypted ` reader ` to plain ` writer `
method
CipherKind
reader
&'a mut R
writer
&'a mut W