Closed Bug 1003470 Opened 10 years ago Closed 7 years ago

Write a network proxy for tunneling http traffic over adb

Categories

(Testing :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: wlach, Assigned: wlach)

Details

So right now Eideticker depends on the device being connected to a wifi network, for loading arbitrary web pages off of the host machine. Unfortunately getting a wifi network reliable enough for this purpose has proven a challenge in the new Mountain View office.

This would also be useful for the fxos-certsuite, as it would mean that our partners wouldn't necessarily need to connect their device and the pc running the tests to the same network, simplifying setup.

adb currently has a special mode that lets you forward a port open on the device to one on the local machine. Unfortunately it does not have the reverse, which is what we need here. It also apparently has some kind of ppp networking mode, but we've been unable to make it work reliably.

So, I propose a new system with the following architecture:

[Host PC] -> [webserver running on PC] -> [PC Proxy App] -> adb debug bridge -> [Device Proxy App]

The device proxy app would listen in two ports, one for the connections from the pc proxy app, another for local connections. It will do nothing until it has received a connection from the host pc. When it does, the host connection with the PC will be left open and used as the channel to tunnel traffic from the device to the host. 

New connections on the device will go to another socket opened by the device proxy app, which will then be forwarded through the connection opened by the host PC (we'll probably have to use some kind of tagging system to disambiguate which requests/responses need to be routed where).

I propose that the PC proxy app be written in python. The Android app should be written in C or C++.

Prior art:

* http://www.codeproject.com/Articles/191930/Android-Usb-Port-Forwarding (Android app that seems to essentially do the above, seems to require Windows and a rooted device so not useful here... also more general than we want)
* https://github.com/mozilla/Negatus (Agent implementation in C++, may be able to reuse socket implementation)
* Chrome for Android apparently has a special developer mode that allows this https://developers.google.com/chrome-developer-tools/docs/remote-debugging#reverse-port-forwarding
web-platform-tests, which is part of firefox-os-certsuite, has the same requirement to load pages from the host machine over the network. For reasons that I don't understand at all this seems to be *very* unreliable on the office network (it might be related to the use of autoproxy to fake a set of domain names). Proxying over adb seems like the clearest way forward to resolve this issue, so unless I can find another solution, this seems like high priority for the certsuite work.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.