# `MobDev.Connector`
[🔗](https://github.com/genericjam/mob_dev/blob/master/lib/mob_dev/connector.ex#L1)

Orchestrates device discovery, tunnel setup, app restart, and node connection.

By default each app is restarted so it registers in the Mac's EPMD through
the tunnels just set up, under the node name and dist port mob_dev expects
(an app started before `adb reverse tcp:4369` existed never registered at
all). `restart: false` attaches to the running app instead and leaves its
state alone; on Android it looks the node up in EPMD under either the
deploy-time name or the bare `<app>_android` a launcher start uses, and
forwards the port that node actually registered.

# `connect_all`

```elixir
@spec connect_all(keyword()) :: {[MobDev.Device.t()], [MobDev.Device.t()]}
```

Discovers all connected devices, sets up tunnels, restarts apps (unless
`restart: false`), and waits for Erlang nodes to come online.

Returns {connected, failed} lists of %Device{}.

# `local_name_from_opts`

```elixir
@spec local_name_from_opts(keyword()) :: node() | nil
```

Reads the `:name` option from `connect_all/1`'s keyword list and returns
it as an atom, or nil when unset: the host node is then
`mob_dev@127.0.0.1`, or a per-process name when that one is taken (see
`MobDev.NodeUtil.start_host_dist/3`).

Public so the option-plumbing is unit-testable without needing to actually
call `Node.start/2` (which would mutate BEAM-global distribution state
and require an `async: false` test module). See MOB-69.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
