Repository navigation
emuly proxy and emuly dev: phone traffic and adb through your computer - #48
Merged
Merged
Conversation
One gh codespace ssh carries adb (-L to adbd 5555, compressed) and extra ports (-R). Handles the phone's own codespace, a second run (lock file), adb lookup in SDK folders, WSL, reconnects and API level warnings. Plan and edge cases in docs/emuly-dev-plan.md.
Runner 23: egress gateway on 127.0.0.1:8792 (CONNECT and plain HTTP, direct or laptop mode, fail closed), DNS forwarder on 127.0.0.77, UDP drop in laptop mode, /egress routes. CLI: emuly proxy <phone> [--via http|socks5] [--lock] [--allow-lan] | off | status. API: /v1/phones/<id>/proxy and /proxy/check. Dashboard traffic row. Skill page proxy.md. Live-tested on a codespace; results in docs/phone-proxy-plan.md.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
- Drop owner_id and phone_id from diagnostic records. A phone reaches its records only through phones.diagnostic_run_id, a random id that changes each phone life. - Remove the EMULY_DIAGNOSTICS_PHONE filter (server and browser). - Count write failures by error class (constraint, busy, timeout, schema, other). - operation() returns its id at once; measure() does not await writes. Writes run in the background queue, kept alive with waitUntil on Vercel. - Test: a 300 ms diagnostics database adds no time to a measured request.
- Every /v1 route is wrapped with withApiUsage. It counts calls by route template, client (cli, skill, browser, curl), auth kind, status class, error code and a time bucket, per UTC day. No user, phone, key, IP or real path is stored. - Pattern counts: retry_same_route, poll_after_wait, screenshot_burst, unknown_route, old_client. The detector window lives in memory only. - Counts flush in one background batch (waitUntil on Vercel). A request never waits. - The CLI sends X-Emuly-Client: cli. Report: scripts/diagnostics.ts ... api (groups under 10 samples hidden). Counts live 180 days.
- diagnostic_states (migration 30): day, release, from/to state, reason, error code, region, power-of-2 bucket. No ids. - lib/diagnostics/state-usage.ts: non-blocking recorder, fixed error codes, states report (10-sample minimum). - Recorded at each state change in phone-mutations.ts; poller and reconcile go through apply(). - New error codes: github_quota, github_auth, kvm_missing, boot_timeout, runner_crash, tunnel_lost. - Retention 180 days. Tests: anonymity, counts, report threshold, slow database.
- Phone page: one 'Internet' row ('Through your computer' / 'Paused, reconnecting'), details behind an info icon.
The proxy's own port row is hidden. More space under the Host row.
- Runner 24: an unlocked laptop proxy with no laptop for 2 minutes goes back to direct.
Live test found that a killed CLI or a sleeping laptop left the phone offline until 'emuly proxy off'.
- Skill: says what happens when the computer drops (runbook 2026-11-25.3).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
Two new CLI commands for working with a phone from your own computer.
emuly proxy <phone>: phone traffic through your computerAll traffic of the phone leaves from your computer, or from a proxy that you name. Use it to test from your own IP, your office network, or a VPN.
--viachains to an upstream HTTP or SOCKS5 proxy, with a login. The password stays on your computer. It is never sent to Emuly, written to disk, or printed.EMULY_PROXY_VIAkeeps it out of shell history.--allow-lanturns this off.--lockkeeps the phone offline instead (fail closed) untilemuly proxy <phone> off.--lock, the runner goes back to direct after 90 s, so the phone is not left offline.emuly dev <phone>: hot reload with local adbOne command connects the phone to adb on your computer, so
flutter run,expo run:androidand Android Studio see it.How it works (proxy on)
flowchart LR subgraph CS["Codespace"] APP["App on the phone"] -->|every TCP connection| GW["Egress gateway<br/>(runner, :8792)"] APP -->|DNS| DNS["DNS forwarder<br/>(:53 on 127.0.0.77)"] APP -.->|other UDP| X["Blocked"] end GW -->|CONNECT, over the link| LP["emuly proxy<br/>on your computer"] DNS -->|DNS over TCP, same link| LP LP --> NET["Internet"] LP -.->|--via| UP["Your upstream proxy"] --> NET-http-proxyto the runner gateway. So the mode changes at run time, with no restart.emuly proxy. If the link is down, the connection fails. It never falls back to direct.10.0.2.2links keep working in both modes.Changes
egress.mjsgateway,egress-dns.mjsforwarder, UDP rules in the phone,GET/POST /egress,POST /egress/check. Mode saved in/workspaces/.emuly/egress.json. Port 8792 reserved.boot.shadds-http-proxyand-dns-server.GET/POST/DELETE /v1/phones/<id>/proxy,POST /v1/phones/<id>/proxy/check. No credentials reach the API.emuly proxy,emuly dev.emuly linkshares its link loop with proxy.references/tasks/proxy.md, runbook version raised.Tests
--lock, auto return to direct without--lock. Details are indocs/phone-proxy-plan.md.pnpm lint,pnpm test,pnpm buildpass.Not tested live yet: Chrome and Flutter on screen, a DNS leak site, a network drop,
--viaagainst a real proxy.