pub enum Version {
V1,
V2,
}
Expand description
The supported PROXY Protocol versions.
Variants§
Implementations§
Source§impl Version
impl Version
Sourcepub const MAGIC_V1: &'static str = "PROXY"
pub const MAGIC_V1: &'static str = "PROXY"
The magic bytes that indicate a PROXY Protocol v1 header.
Sourcepub const MAGIC_V2: &'static [u8; 12] = b"\r\n\r\n\x00\r\nQUIT\n"
pub const MAGIC_V2: &'static [u8; 12] = b"\r\n\r\n\x00\r\nQUIT\n"
The magic bytes that indicate a PROXY Protocol v2 header.
Sourcepub fn peek(buf: &[u8]) -> Result<Option<Self>, ()>
pub fn peek(buf: &[u8]) -> Result<Option<Self>, ()>
Peeks into the given buffer to determine if it contains a valid PROXY Protocol version magic.
§Behaviours
If the buffer is too short to determine the version, Ok(None)
is
returned. If the buffer contains a valid version magic,
Ok(Some(Version))
is returned. Otherwise, Err(())
is returned.
Trait Implementations§
impl Copy for Version
impl Eq for Version
impl StructuralPartialEq for Version
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
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