pub struct MitmResponse {
pub source: String,
pub destination: Option<SocketAddr>,
pub timestamp: u64,
pub response: Response,
/* private fields */
}Expand description
MITM Response wrapper that wraps slinger::Response with connection metadata. Used for both HTTP and non-HTTP (raw TCP) traffic interception.
Fields§
§source: StringSource address (where the response came from, host:port)
destination: Option<SocketAddr>Destination address and port (client)
timestamp: u64Timestamp when the response was intercepted
response: ResponseThe underlying response (contains body for both HTTP and raw TCP)
Implementations§
Source§impl MitmResponse
impl MitmResponse
Sourcepub fn new(
session_id: u128,
source: impl Into<String>,
response: Response,
) -> Self
pub fn new( session_id: u128, source: impl Into<String>, response: Response, ) -> Self
Create a new MITM response wrapper for HTTP traffic The session_id should match the corresponding MitmRequest’s session_id
Sourcepub fn with_destination(
session_id: u128,
source: impl Into<String>,
destination: SocketAddr,
response: Response,
) -> Self
pub fn with_destination( session_id: u128, source: impl Into<String>, destination: SocketAddr, response: Response, ) -> Self
Create a new MITM response with destination address for HTTP traffic The session_id should match the corresponding MitmRequest’s session_id
Sourcepub fn raw_tcp(
session_id: u128,
source: impl Into<String>,
body: impl Into<Bytes>,
) -> Self
pub fn raw_tcp( session_id: u128, source: impl Into<String>, body: impl Into<Bytes>, ) -> Self
Create a MITM response for raw TCP data (non-HTTP) The session_id should match the corresponding MitmRequest’s session_id
Sourcepub fn raw_tcp_with_destination(
session_id: u128,
source: impl Into<String>,
destination: SocketAddr,
body: impl Into<Bytes>,
) -> Self
pub fn raw_tcp_with_destination( session_id: u128, source: impl Into<String>, destination: SocketAddr, body: impl Into<Bytes>, ) -> Self
Create a MITM response for raw TCP data with destination address The session_id should match the corresponding MitmRequest’s session_id
Sourcepub fn session_id(&self) -> u128
pub fn session_id(&self) -> u128
Get the session ID (used to correlate response with request)
Sourcepub fn destination(&self) -> Option<SocketAddr>
pub fn destination(&self) -> Option<SocketAddr>
Get the destination address
Sourcepub fn response_mut(&mut self) -> &mut Response
pub fn response_mut(&mut self) -> &mut Response
Get a mutable reference to the underlying response
Trait Implementations§
Source§impl Clone for MitmResponse
impl Clone for MitmResponse
Source§fn clone(&self) -> MitmResponse
fn clone(&self) -> MitmResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more