Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Dec 29, 2024
1 parent edafe8e commit acf5e57
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/python-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.10
6 changes: 3 additions & 3 deletions mitmproxy-linux/src/main2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ async fn main() -> anyhow::Result<()> {
};

packet.encode(&mut ipc_buf)?;

info!("Sending packet: {} {:?}", ipc_buf.len(), &ipc_buf);
let encoded = ipc_buf.split();
ipc.send(encoded.as_ref()).await?;

info!("Sending packet to proxy: {} {:?}", encoded.len(), &encoded);
ipc.send(&encoded).await?;
},
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/packet_sources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async fn forward_packets<T: AsyncRead + AsyncWrite + Unpin>(
msg.encode(&mut buf.as_mut_slice())?;
let len = msg.encoded_len();

info!("Sending IPC message: {len} {:?}", &buf[..len]);
info!("Sending IPC message to redirector: {len} {:?}", &buf[..len]);

channel.write_all(&buf[..len]).await.context("failed to propagate interception config update")?;
},
Expand All @@ -93,8 +93,8 @@ async fn forward_packets<T: AsyncRead + AsyncWrite + Unpin>(
warn!("Receiving packet: {} {:?}", len, &buf[..len]);

let mut cursor = Cursor::new(&buf[..len]);
let Ok(PacketWithMeta { data, tunnel_info: Some(ipc::TunnelInfo { pid, process_name })}) = PacketWithMeta::decode(&mut cursor) else {
return Err(anyhow!("Received invalid IPC message: {:?}", &buf[..len]));
let Ok(PacketWithMeta { data, tunnel_info}) = PacketWithMeta::decode(&mut cursor) else {
return Err(anyhow!("Received invalid IPC message from redirector: {:?}", &buf[..len]));
};
assert_eq!(cursor.position(), len as u64);

Expand All @@ -112,8 +112,8 @@ async fn forward_packets<T: AsyncRead + AsyncWrite + Unpin>(
let event = NetworkEvent::ReceivePacket {
packet,
tunnel_info: TunnelInfo::LocalRedirector {
pid,
process_name,
pid: tunnel_info.as_ref().and_then(|t| t.pid),
process_name: tunnel_info.and_then(|t| t.process_name),
remote_endpoint: None,
},
};
Expand Down

0 comments on commit acf5e57

Please sign in to comment.