Skip to content

Conversation

@SternXD
Copy link

@SternXD SternXD commented Nov 12, 2025

Reimplements (em_proxy) tool using the new idevice libraries. This tool gives a proxy for TCP packets to work around iOS loopback limitations by modifying packets and retransmitting them through a tunnel.

Changes

  • Reimpled em_proxy binary with support for both WireGuard and CoreDeviceProxy tunnel modes
  • Added CoreDeviceProxy support with proper address translation (localhost <-> tunnel IPs)
  • Updated core_device_proxy_tun.rs to use the new tun-rs 2.7.4 API (DeviceBuilder instead of the deprecated one)
  • Implemented address translation for CoreDeviceProxy mode:
    • Outbound: Translates 127.0.0.1 to tunnel IPs (client/server from CoreDeviceProxy handshake)
    • Inbound: Translates tunnel IPs back to 127.0.0.1
  • WireGuard mode uses IP address swapping (bytes 12-15 <-> 16-19) as in the original implementation
  • Added key loading for WireGuard keys from CLI args, files, or default directories

Tech Details

  • Uses tun-rs for TUN in CoreDeviceProxy mode
  • Uses boringtun for WireGuard handling
  • feature-gates WireGuard specific code with #[cfg(feature = "wireguard")]
  • CoreDeviceProxy mode is the default/recommended approach (in my opinion)

Testing

  • Compiles with both wireguard and core-device features
  • Passes just macos-ci-check
  • Passes cargo fmt --check
  • Needs testing (other then just compiling it)

Related

Based on the original implementation (https://github.com/jkcoxson/em_proxy)

Reimplements em_proxy with support for both WireGuard (boringtun) and
CoreDeviceProxy tunnels. Modifies packets by swapping source/destination
IP addresses to route through tunnels instead of localhost.

Based on the original implementation by jkcoxson (https://github.com/jkcoxson/em_proxy)
@SternXD SternXD requested a review from jkcoxson November 17, 2025 18:02
@SternXD SternXD marked this pull request as draft November 22, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants