pub struct HeaderEncoder<Stage = Magic> { /* private fields */ }
Expand description
Encoder for a PROXY Protocol v2 header.
Implementations§
Source§impl HeaderEncoder<Magic>
impl HeaderEncoder<Magic>
Source§impl HeaderEncoder<Finished>
impl HeaderEncoder<Finished>
Sourcepub fn write_ext_alpn(self, alpn: &[u8]) -> Result<Self, EncodeError>
pub fn write_ext_alpn(self, alpn: &[u8]) -> Result<Self, EncodeError>
Writes the ALPN
extension bytes to the header.
See ExtensionType::ALPN
.
Writes the Authority
extension bytes to the header.
Sourcepub fn write_ext_no_op(self, padding: u16) -> Result<Self, EncodeError>
pub fn write_ext_no_op(self, padding: u16) -> Result<Self, EncodeError>
Writes padding zeros to the header, the total size is 3 + padding
.
See ExtensionType::NoOp
.
Sourcepub fn write_ext_unique_id(self, payload: &[u8]) -> Result<Self, EncodeError>
pub fn write_ext_unique_id(self, payload: &[u8]) -> Result<Self, EncodeError>
Writes the UniqueId
extension bytes to the header.
Sourcepub fn write_ext_network_namespace(
self,
payload: &[u8],
) -> Result<Self, EncodeError>
pub fn write_ext_network_namespace( self, payload: &[u8], ) -> Result<Self, EncodeError>
Writes the NetworkNamespace
extension bytes to the header.
Sourcepub fn write_ext_custom(self, extension: ExtensionRef<'_>) -> Self
pub fn write_ext_custom(self, extension: ExtensionRef<'_>) -> Self
Writes a custom extension to the header.
Notice: will not check if the typ
is valid.
Sourcepub fn finish_with_crc32c(self) -> Result<Vec<u8>, EncodeError>
pub fn finish_with_crc32c(self) -> Result<Vec<u8>, EncodeError>
Calculates and writes the CRC32C
extension bytes to the header and
finalizes the header encoding.
Trait Implementations§
Auto Trait Implementations§
impl<Stage> Freeze for HeaderEncoder<Stage>
impl<Stage> RefUnwindSafe for HeaderEncoder<Stage>where
Stage: RefUnwindSafe,
impl<Stage> Send for HeaderEncoder<Stage>where
Stage: Send,
impl<Stage> Sync for HeaderEncoder<Stage>where
Stage: Sync,
impl<Stage> Unpin for HeaderEncoder<Stage>where
Stage: Unpin,
impl<Stage> UnwindSafe for HeaderEncoder<Stage>where
Stage: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more