pub struct MitmRequest {
pub source: Option<SocketAddr>,
pub destination: String,
pub timestamp: u64,
pub request: Request,
/* private fields */
}Expand description
MITM Request wrapper that wraps slinger::Request with connection metadata. Used for both HTTP and non-HTTP (raw TCP) traffic interception.
Fields§
§source: Option<SocketAddr>Source address and port (client)
destination: StringDestination address (host:port)
timestamp: u64Timestamp when the request was intercepted
request: RequestThe underlying request (contains body for both HTTP and raw TCP)
Implementations§
Source§impl MitmRequest
impl MitmRequest
Sourcepub fn new(destination: impl Into<String>, request: Request) -> Self
pub fn new(destination: impl Into<String>, request: Request) -> Self
Create a new MITM request wrapper for HTTP traffic
Sourcepub fn with_source(
source: SocketAddr,
destination: impl Into<String>,
request: Request,
) -> Self
pub fn with_source( source: SocketAddr, destination: impl Into<String>, request: Request, ) -> Self
Create a new MITM request with source address for HTTP traffic
Sourcepub fn raw_tcp(destination: impl Into<String>, body: impl Into<Bytes>) -> Self
pub fn raw_tcp(destination: impl Into<String>, body: impl Into<Bytes>) -> Self
Create a MITM request for raw TCP data (non-HTTP)
Sourcepub fn raw_tcp_with_source(
source: SocketAddr,
destination: impl Into<String>,
body: impl Into<Bytes>,
) -> Self
pub fn raw_tcp_with_source( source: SocketAddr, destination: impl Into<String>, body: impl Into<Bytes>, ) -> Self
Create a MITM request for raw TCP data with source address
Sourcepub fn session_id(&self) -> u128
pub fn session_id(&self) -> u128
Get the session ID (used to correlate request with response)
Sourcepub fn set_session_id(&mut self, session_id: u128)
pub fn set_session_id(&mut self, session_id: u128)
Set the session ID (used to override auto-generated session_id for TCP connections)
Sourcepub fn source(&self) -> Option<SocketAddr>
pub fn source(&self) -> Option<SocketAddr>
Get the source address
Sourcepub fn destination(&self) -> &str
pub fn destination(&self) -> &str
Get the destination address
Sourcepub fn request_mut(&mut self) -> &mut Request
pub fn request_mut(&mut self) -> &mut Request
Get a mutable reference to the underlying request
Trait Implementations§
Source§impl Clone for MitmRequest
impl Clone for MitmRequest
Source§fn clone(&self) -> MitmRequest
fn clone(&self) -> MitmRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more