diff --git a/common/ip-packet-requests/src/codec.rs b/common/ip-packet-requests/src/codec.rs index 86df1ce8f7..4047fec8e7 100644 --- a/common/ip-packet-requests/src/codec.rs +++ b/common/ip-packet-requests/src/codec.rs @@ -34,6 +34,13 @@ impl MultiIpPacketCodec { } } + pub fn bundle_one_packet(packet: Bytes) -> Bytes { + let mut bundled_packets = BytesMut::new(); + bundled_packets.extend_from_slice(&(packet.len() as u16).to_be_bytes()); + bundled_packets.extend_from_slice(&packet); + bundled_packets.freeze() + } + // Append a packet to the buffer and return the buffer if it's full pub fn append_packet(&mut self, packet: Bytes) -> Option { let mut bundled_packets = BytesMut::new(); @@ -47,7 +54,7 @@ impl MultiIpPacketCodec { } // Flush the current buffer and return it. - fn flush_current_buffer(&mut self) -> Bytes { + pub fn flush_current_buffer(&mut self) -> Bytes { let mut output_buffer = BytesMut::new(); std::mem::swap(&mut output_buffer, &mut self.buffer); output_buffer.freeze() diff --git a/sdk/rust/nym-sdk/src/mixnet/native_client.rs b/sdk/rust/nym-sdk/src/mixnet/native_client.rs index e00322ec71..c4e4c13739 100644 --- a/sdk/rust/nym-sdk/src/mixnet/native_client.rs +++ b/sdk/rust/nym-sdk/src/mixnet/native_client.rs @@ -174,6 +174,7 @@ impl MixnetClient { } } +#[derive(Clone)] pub struct MixnetClientSender { client_input: ClientInput, packet_type: Option,