Make HEADER_LEN public

This commit is contained in:
David Lönnhager 2024-10-18 15:56:31 +02:00
parent 59913ab0f7
commit c4c839bd11
2 changed files with 4 additions and 1 deletions

View File

@ -21,7 +21,7 @@ use tokio::time::timeout;
/// read operation would ever return. We are going to use that extra space
/// to store our 2 byte udp-over-tcp header.
pub const MAX_DATAGRAM_SIZE: usize = u16::MAX as usize;
const HEADER_LEN: usize = mem::size_of::<u16>();
pub const HEADER_LEN: usize = mem::size_of::<u16>();
/// Forward traffic between the given UDP and TCP sockets in both directions.
/// This async function runs until one of the sockets are closed or there is an error.

View File

@ -93,6 +93,9 @@ mod tcp_options;
pub use tcp_options::{ApplyTcpOptionsError, ApplyTcpOptionsErrorKind, TcpOptions};
/// Size of the header (in bytes) that is prepended to each datagram in the TCP stream.
pub use forward_traffic::HEADER_LEN;
/// Helper trait for `Result<Infallible, E>` types. Allows getting the `E` value
/// in a way that is guaranteed to not panic.
pub trait NeverOkResult<E> {