pub fn encrypt_payload(
    context: &Context,
    method: CipherKind,
    key: &[u8],
    payload: &[u8],
    dst: &mut BytesMut,
) -> io::Result<()> {
    match method.category() {
        CipherCategory::None => {
            // FIXME: Is there a better way to prevent copying?
            dst.put_slice(payload);
            Ok(())
        }
        CipherCategory::Stream => encrypt_payload_stream(context, method, key, payload, dst),
        CipherCategory::Aead => encrypt_payload_aead(context, method, key, payload, dst),
    }
}
/// Encrypt payload into ShadowSocks UDP encrypted packet
Encrypt payload into ShadowSocks UDP encrypted packet
Encrypt payload into ShadowSocks UDP encrypted packet
pub fn encrypt_payload(
    context: &Context,
    method: CipherKind,
    key: &[u8],
    payload: &[u8],
    dst: &mut BytesMut,
) -> io::Result<()> {
    match method.category() {
        CipherCategory::None => {
            // FIXME: Is there a better way to prevent copying?
            dst.put_slice(payload);
            Ok(())
        }
        CipherCategory::Stream => encrypt_payload_stream(context, method, key, payload, dst),
        CipherCategory::Aead => encrypt_payload_aead(context, method, key, payload, dst),
    }
}
pub fn encrypt_payload ( context : & Context , method : CipherKind , key : & [ u8 ] , payload : & [ u8 ] , dst : & mut BytesMut , ) -> io :: Result < ( ) > { match method . category ( ) { CipherCategory :: None => { // FIXME: Is there a better way to prevent copying? dst . put_slice ( payload ) ; Ok ( ( ) ) } CipherCategory :: Stream => encrypt_payload_stream ( context , method , key , payload , dst ) , CipherCategory :: Aead => encrypt_payload_aead ( context , method , key , payload , dst ) , } }
Encrypt payload into ShadowSocks UDP encrypted packet
Encrypt payload into ShadowSocks UDP encrypted packet
context
&Context
method
CipherKind
key
&[u8]
payload
&[u8]
dst
&mut BytesMut