pub fn decrypt_payload(
    context: &Context,
    method: CipherKind,
    key: &[u8],
    payload: &[u8],
) -> io::Result<Option<Vec<u8>>> {
    match method.category() {
        CipherCategory::None => {
            // FIXME: Is there a better way to prevent copying?
            let mut buf = Vec::with_capacity(payload.len());
            buf.extend_from_slice(payload);
            Ok(Some(buf))
        }
        CipherCategory::Stream => decrypt_payload_stream(context, method, key, payload),
        CipherCategory::Aead => decrypt_payload_aead(context, method, key, payload),
    }
}
/// Decrypt payload from ShadowSocks UDP encrypted packet
Decrypt payload from ShadowSocks UDP encrypted packet
Decrypt payload from ShadowSocks UDP encrypted packet
pub fn decrypt_payload(
    context: &Context,
    method: CipherKind,
    key: &[u8],
    payload: &[u8],
) -> io::Result<Option<Vec<u8>>> {
    match method.category() {
        CipherCategory::None => {
            // FIXME: Is there a better way to prevent copying?
            let mut buf = Vec::with_capacity(payload.len());
            buf.extend_from_slice(payload);
            Ok(Some(buf))
        }
        CipherCategory::Stream => decrypt_payload_stream(context, method, key, payload),
        CipherCategory::Aead => decrypt_payload_aead(context, method, key, payload),
    }
}
pub fn decrypt_payload ( context : & Context , method : CipherKind , key : & [ u8 ] , payload : & [ u8 ] , ) -> io :: Result < Option < Vec < u8 > > > { match method . category ( ) { CipherCategory :: None => { // FIXME: Is there a better way to prevent copying? let mut buf = Vec :: with_capacity ( payload . len ( ) ) ; buf . extend_from_slice ( payload ) ; Ok ( Some ( buf ) ) } CipherCategory :: Stream => decrypt_payload_stream ( context , method , key , payload ) , CipherCategory :: Aead => decrypt_payload_aead ( context , method , key , payload ) , } }
Decrypt payload from ShadowSocks UDP encrypted packet
Decrypt payload from ShadowSocks UDP encrypted packet
context
&Context
method
CipherKind
key
&[u8]
payload
&[u8]