DalaDev.Tunnel (dala_dev v0.0.3)

Copy Markdown View Source

Manages port tunnels for Android and physical iOS devices.

Android (adb)

  • adb reverse tcp:4369 tcp:4369 — Android BEAM registers in Mac's EPMD
  • adb forward tcp:<dist> tcp:9100 — Mac reaches device's dist port

Physical iOS (direct networking — USB preferred, WiFi/LAN fallback)

  • dala_beam.m finds the device's own IP via getifaddrs() and starts the BEAM as dala_qa_ios@<device-ip>
  • The in-process EPMD binds 0.0.0.0:4369 so Mac can query it at <device-ip>:4369
  • The dist port is directly reachable

iOS Simulator

  • Shares Mac network stack — no tunnels needed

Summary

Functions

Returns the dist port for a given device index (same formula used in setup/2).

Assigns a dist port and sets up tunnels for a device. Returns {:ok, %Device{}} with dist_port and host_ip filled in, or {:error, reason}.

Tears down tunnels for a device.

Types

result()

@type result() :: {:ok, DalaDev.Device.t()} | {:error, String.t()}

teardown_result()

@type teardown_result() :: :ok

Functions

dist_port(index)

@spec dist_port(non_neg_integer()) :: non_neg_integer()

Returns the dist port for a given device index (same formula used in setup/2).

setup(device, index \\ 0)

@spec setup(DalaDev.Device.t(), non_neg_integer()) ::
  {:ok, DalaDev.Device.t()} | {:error, String.t()}

Assigns a dist port and sets up tunnels for a device. Returns {:ok, %Device{}} with dist_port and host_ip filled in, or {:error, reason}.

teardown(device)

@spec teardown(DalaDev.Device.t()) :: :ok

Tears down tunnels for a device.