@@ -308,17 +308,7 @@ async fn dispatch_tunnel(
308308 return do_sni_rewrite_tunnel_from_tcp ( sock, & host, port, mitm, rewrite_ctx) . await ;
309309 }
310310
311- // 2. IP-literal destinations are almost always app-level custom protocols
312- // (xray/VLESS, torrent, SSH, VPN, raw TCP). Browsers never use raw IPs
313- // in CONNECT. MITMing these would break the app's own TLS/auth, and
314- // trying to relay opaque bytes through Apps Script always fails.
315- // Always plain TCP passthrough for IP literals.
316- if is_ip_literal ( & host) {
317- plain_tcp_passthrough ( sock, & host, port) . await ;
318- return Ok ( ( ) ) ;
319- }
320-
321- // 3. Peek at the first byte to detect TLS vs plain. Time-bounded — if the
311+ // 2. Peek at the first byte to detect TLS vs plain. Time-bounded — if the
322312 // client doesn't send anything within 300ms, assume server-first
323313 // protocol (SMTP, POP3, FTP banner) and jump straight to plain TCP.
324314 let mut peek_buf = [ 0u8 ; 8 ] ;
@@ -355,13 +345,6 @@ async fn dispatch_tunnel(
355345 Ok ( ( ) )
356346}
357347
358- // ---------- IP literal detection ----------
359-
360- fn is_ip_literal ( host : & str ) -> bool {
361- let h = host. trim_start_matches ( '[' ) . trim_end_matches ( ']' ) ;
362- h. parse :: < std:: net:: IpAddr > ( ) . is_ok ( )
363- }
364-
365348// ---------- Plain TCP passthrough ----------
366349
367350async fn plain_tcp_passthrough ( mut sock : TcpStream , host : & str , port : u16 ) {
0 commit comments