pub fn new(stream_ty: StreamType, method: CipherKind, key: &[u8], nonce: &[u8]) -> Self {
        if cfg!(not(feature = "aead-cipher-2022")) {
            let _ = stream_ty;
        }

        match method.category() {
            #[cfg(feature = "stream-cipher")]
            CipherCategory::Stream => Self::Stream(StreamEncryptedWriter::new(method, key, nonce)),
            #[cfg(feature = "aead-cipher")]
            CipherCategory::Aead => Self::Aead(AeadEncryptedWriter::new(method, key, nonce)),
            CipherCategory::None => {
                let _ = key;
                let _ = nonce;
                Self::None
            }
            #[cfg(feature = "aead-cipher-2022")]
            CipherCategory::Aead2022 => {
                Self::Aead2022(Aead2022EncryptedWriter::new(stream_ty, method, key, nonce))
            }
        }
    }
Create a new writer for writing encrypted data
crates/shadowsocks/src/relay/tcprelay/crypto_io.rs