From c8b80f269f2a9bb0e6380e7f72e5e7c94cf39ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20L=C3=B6nnhager?= Date: Fri, 18 Oct 2024 15:56:31 +0200 Subject: [PATCH] Make HEADER_LEN public --- src/forward_traffic.rs | 2 +- src/lib.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/forward_traffic.rs b/src/forward_traffic.rs index 95714ad..cf08b8a 100644 --- a/src/forward_traffic.rs +++ b/src/forward_traffic.rs @@ -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::(); +pub const HEADER_LEN: usize = mem::size_of::(); /// 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. diff --git a/src/lib.rs b/src/lib.rs index ab11191..b0a9db4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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` types. Allows getting the `E` value /// in a way that is guaranteed to not panic. pub trait NeverOkResult {