From 3b5f803da89c30bc6f7e6204092c7cfafdaf5f35 Mon Sep 17 00:00:00 2001 From: "B. Blechschmidt" Date: Tue, 22 Aug 2023 18:36:51 +0200 Subject: [PATCH] Get first version of DNS over TCP to work --- src/tun2proxy.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/tun2proxy.rs b/src/tun2proxy.rs index d33cb8c..bb6c532 100644 --- a/src/tun2proxy.rs +++ b/src/tun2proxy.rs @@ -514,15 +514,12 @@ impl<'a> TunToProxy<'a> { let err = "udp over tcp state not find"; let state = self.connection_map.get_mut(info).ok_or(err)?; state.udp_over_tcp_expiry = Some(Self::common_udp_life_timeout()); - if state.tcp_proxy_handler.connection_established() { - _ = state.mio_stream.write(&buf)?; - } else { - // FIXME: Build an IP packet with TCP and inject it into the device, - // or cache them and send them when the connection is established? - // self.device.inject_packet(&buf); - state.udp_over_tcp_data_cache.push_back(buf); - } + let data_event = IncomingDataEvent { + direction: IncomingDirection::FromClient, + buffer: &buf, + }; + state.tcp_proxy_handler.push_data(data_event)?; Ok(()) }