pub fn encrypt_server_payload(
    context: &Context,
    method: CipherKind,
    key: &[u8],
    addr: &Address,
    control: &UdpSocketControlData,
    payload: &[u8],
    dst: &mut BytesMut,
) {
    match method.category() {
        CipherCategory::None => {
            let _ = context;
            let _ = key;
            let _ = control;
            dst.reserve(addr.serialized_len() + payload.len());
            addr.write_to_buf(dst);
            dst.put_slice(payload);
        }
        #[cfg(feature = "stream-cipher")]
        CipherCategory::Stream => {
            let _ = control;
            encrypt_payload_stream(context, method, key, addr, payload, dst)
        }
        #[cfg(feature = "aead-cipher")]
        CipherCategory::Aead => {
            let _ = control;
            encrypt_payload_aead(context, method, key, addr, payload, dst)
        }
        #[cfg(feature = "aead-cipher-2022")]
        CipherCategory::Aead2022 => encrypt_server_payload_aead_2022(context, method, key, addr, control, payload, dst),
    }
}
Encrypt `Server -> Client` payload into ShadowSocks UDP encrypted packet
crates/shadowsocks/src/relay/udprelay/crypto_io.rs