Skip to content

Commit 7ded103

Browse files
committed
mitm: adjust for e4dec96
1 parent e4dec96 commit 7ded103

File tree

1 file changed

+20
-29
lines changed

1 file changed

+20
-29
lines changed

src/mitm.rs

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use protobuf::text_format::print_to_string_pretty;
2727
use protobuf::{Enum, Message, MessageDyn};
2828
use protos::ControlMessageType::{self, *};
2929

30+
use crate::config::AppConfig;
3031
use crate::config::HexdumpLevel;
31-
use crate::config::SharedConfig;
3232
use crate::ev::RestContext;
3333
use crate::io_uring::Endpoint;
3434
use crate::io_uring::IoDevice;
@@ -651,20 +651,11 @@ pub async fn proxy<A: Endpoint<A> + 'static>(
651651
tx: Sender<Packet>,
652652
mut rx: Receiver<Packet>,
653653
mut rxr: Receiver<Packet>,
654-
config: SharedConfig,
654+
config: AppConfig,
655655
rest_ctx: Option<Arc<tokio::sync::Mutex<RestContext>>>,
656656
) -> Result<()> {
657-
// load needed config options to local variables
658-
let passthrough = !config.read().await.mitm;
659-
let hex_requested = config.read().await.hexdump_level;
660-
let dpi = config.read().await.dpi;
661-
let developer_mode = config.read().await.developer_mode;
662-
let disable_media_sink = config.read().await.disable_media_sink;
663-
let disable_tts_sink = config.read().await.disable_tts_sink;
664-
let remove_tap_restriction = config.read().await.remove_tap_restriction;
665-
let video_in_motion = config.read().await.video_in_motion;
666-
let ev = config.read().await.ev;
667-
let ev_battery_logger = &config.read().await.ev_battery_logger;
657+
let passthrough = !config.mitm;
658+
let hex_requested = config.hexdump_level;
668659

669660
// in full_frames/passthrough mode we only directly pass packets from one endpoint to the other
670661
if passthrough {
@@ -799,16 +790,16 @@ pub async fn proxy<A: Endpoint<A> + 'static>(
799790
let handled = pkt_modify_hook(
800791
proxy_type,
801792
&mut pkt,
802-
dpi,
803-
developer_mode,
804-
disable_media_sink,
805-
disable_tts_sink,
806-
remove_tap_restriction,
807-
video_in_motion,
808-
ev,
793+
config.dpi,
794+
config.developer_mode,
795+
config.disable_media_sink,
796+
config.disable_tts_sink,
797+
config.remove_tap_restriction,
798+
config.video_in_motion,
799+
config.ev,
809800
&mut ctx,
810801
rest_ctx.clone(),
811-
ev_battery_logger.clone(),
802+
config.ev_battery_logger.clone(),
812803
)
813804
.await?;
814805
let _ = pkt_debug(
@@ -844,16 +835,16 @@ pub async fn proxy<A: Endpoint<A> + 'static>(
844835
let _ = pkt_modify_hook(
845836
proxy_type,
846837
&mut pkt,
847-
dpi,
848-
developer_mode,
849-
disable_media_sink,
850-
disable_tts_sink,
851-
remove_tap_restriction,
852-
video_in_motion,
853-
ev,
838+
config.dpi,
839+
config.developer_mode,
840+
config.disable_media_sink,
841+
config.disable_tts_sink,
842+
config.remove_tap_restriction,
843+
config.video_in_motion,
844+
config.ev,
854845
&mut ctx,
855846
rest_ctx.clone(),
856-
ev_battery_logger.clone(),
847+
config.ev_battery_logger.clone(),
857848
)
858849
.await?;
859850
let _ = pkt_debug(

0 commit comments

Comments
 (0)