pub struct InterceptEndpoint {
pub addr: SocketAddr,
pub token: [u8; 32],
}Expand description
Where a backend redirects intercepted flows, and the secret it must present.
Fields§
§addr: SocketAddrLoopback listener owned by the interceptor.
token: [u8; 32]Secret shared between the interceptor and the machine’s backend only.
Implementations§
Source§impl InterceptEndpoint
impl InterceptEndpoint
Sourcepub fn preamble(&self, destination: SocketAddr) -> Vec<u8> ⓘ
pub fn preamble(&self, destination: SocketAddr) -> Vec<u8> ⓘ
Encode the preamble for one redirected flow.
Sourcepub fn write_preamble<W: Write>(
&self,
w: W,
destination: SocketAddr,
) -> Result<()>
pub fn write_preamble<W: Write>( &self, w: W, destination: SocketAddr, ) -> Result<()>
Write the preamble for destination to a freshly connected stream.
Sourcepub fn read_preamble<R: Read>(&self, r: R) -> Result<SocketAddr>
pub fn read_preamble<R: Read>(&self, r: R) -> Result<SocketAddr>
Read and authenticate a preamble from an accepted connection.
Returns the destination the guest dialed. A wrong magic, version or
token is reported as InvalidData after consuming the fixed header so
the caller can simply drop the connection; the token comparison does not
short-circuit on the first differing byte.
Trait Implementations§
Source§impl Clone for InterceptEndpoint
impl Clone for InterceptEndpoint
impl Copy for InterceptEndpoint
Source§impl Debug for InterceptEndpoint
impl Debug for InterceptEndpoint
Source§impl<'de> Deserialize<'de> for InterceptEndpoint
impl<'de> Deserialize<'de> for InterceptEndpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for InterceptEndpoint
Source§impl PartialEq for InterceptEndpoint
impl PartialEq for InterceptEndpoint
Source§impl Serialize for InterceptEndpoint
impl Serialize for InterceptEndpoint
impl StructuralPartialEq for InterceptEndpoint
Auto Trait Implementations§
impl Freeze for InterceptEndpoint
impl RefUnwindSafe for InterceptEndpoint
impl Send for InterceptEndpoint
impl Sync for InterceptEndpoint
impl Unpin for InterceptEndpoint
impl UnsafeUnpin for InterceptEndpoint
impl UnwindSafe for InterceptEndpoint
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