Tether Launches HTML5-Based iPhone Tethering Solution
macrumors.com
macrumors.com
On the client (the Mac) they have a IOKit ethernet driver that shows up in Network Settings. This becomes your default route (after some fake DHCP magic) and then captures packets and relays them to their application that runs in userland.
Their userland application contains a lightweight TCP/IP stack that interprets those packets. (For example http://www.sics.se/~adam/lwip/)
The lightweight TCP/IP stack contains unimplemented callbacks for opening/closing sending/receiving data. In this case those callbacks are implemented as a higher level network protocol.
That 'wrapped' TCP/IP protocol is then relayed to the iPhone via the usbmux protocol. This allows you to map a TCP/IP service on the device to a local port on the Mac. (I happen to have written a nice usbmux proxy three years ago)
So now the wrapped TCP/IP is arriving at the iPhone, in the form of higher level 'network stack commands'. The iPhone app now simply has to interpret these commands and translate them into real socket open/close read/write commands.
At this point packets are flowing through a fake Ethernet device driver to a secondary TCP/IP stack, over a USB cable to an iOS app which will do actual socket calls and talk to the real network.
Soooo, my guess is that for this new app they use basically the same setup except that the iOS app is gone and replaced with a simple web page with web sockets that point to both that fake TCP/IP stack on the mac and to a hosted proxy service on their end. Relaying data back and forth.
Crazy hack. Amazing it works :-)
So, I feel like you've left out the key non-obvious part: it turns out that even if you do the brain-dead un-optimized "let's use Amazon EC2" for your proxies, $30/yr at $0.05c/GB (down: up is free) buys 50GB/mo.
Given that the user is then going to be filing this data over their 3G connections, 50GB/mo is (based on reports of users tethering that complain about rate limiting and caps) at the very high-end of usage.
So, with that aside, the rest of this actually boils down to: "the webpage just makes two outgoing websocket connections; one to a proxy, and the other to an app on the PC, itself providing a custom network driver".
However, for this particular service, I think that you could get away with much less by leveraging existing work: modify an OpenVPN client so that it has an additional listen socket; then, use a websockets-based relay to link the OpenVPN client's listen socket and your OpenVPN servers.
A nice thing about this setup is that the webpage with the websockets relay can be dynamically generated and point to any server of your choice for quick load-balancing; it would also make it difficult for carriers to block any single server. The biggest problem would be scaling, since OpenVPN might load a server with just hundreds of active clients (http://forums.openvpn.net/topic9148.html), in which case a custom solution might be better...
Regardless of how they did it, very clever workaround!
Glad to see it's got you thinking :). It took a lot of brainstorming and testing/debugging to get this up and running.
Hope you enjoy it!
Let's just say it's magic.
If anything, simply releasing a "Here's what the client is doing so recreate it however possible..." might suffice.
(edited; previously sounded impolite)
Pricing wise, the first year costs $15 and will be $30 from second year on. They set my paypal up for recurring payment.
Performance wise it's pretty fast on my iPhone 4. Setting up took about 2~3 min, very easy to do. The html5 app needs to connect to both the tether website and the client computer. Took me a few tries to connect to both but once they are connected the speed is pretty comparable to tetherme in jailbroken iPhones.
Excuse my ignorance of Apple products but how can tethering work on a device without a internet connection ? You want to go trough a iPad proxy to get to a WiFi connection ? Why not just connect to WiFi with the PC ?
But if you're friends with an iOS developer, you can ask him or her to build an ad-hoc copy of iProxy for your iPhone and it won't cost you anything.
(Or get 100 of your closest iPhone-using friends to pitch in on an iOS developer account)
I'm not really aware of that stuff, but I'm a bit curious. Do websockets really work over mobile networks (which are, at least in my experience, transparent proxied, and where anything outside of HTTP-on-port-80/HTTPS-on-port-443 is blacklisted into oblivion) ?
Even if that weren't true, websockets was designed to look a whole lot like HTTP precisely so that it could work with existing proxies and firewalls.
Once upon a time, I used the very first iPhone proxy application (NetShare), it was significantly more fiddly than native support. And of course you couldn't use the phone while it proxied, that's not an issue with native support.
Doesn't inspire confidence :(
Great product idea though!
I can assure you that the data is encrypted from the phone to the server and never stored anywhere.
The real trick is that they found a way to pipe data from the iPhone to the Mac without going through the internet, all using a good ol' browser web page.
Is there another way to distribute their native version besides through the app store?
My company use TestFlight (https://testflightapp.com/) for iOS game development. Is there anything similar, but better suited to end-user distribution?
Sockets alone are not enough -- you need cooperation from the OS to route connections over both wifi and cell data links in the desired fashion.
In this case we can infer it's two connections made by a script running on a web page: one with the "tethered" machine (over wifi) and one with Tether's proxy server (over cell data). The proxy server works in concert with a client on the tethered machine, and the script just relays data between those two connections.
The interesting thing is that iOS permits a single web page to connect over both network links simultaneously. I'm no expert but that seems like something Apple could, and would, kill with an update.
Really clever hack, though.
Small NodeJS app that serves the client connection webpage and acts as a proxy. Set the proxy locally, When you get requests instead of fetching them ask the socket for the data and headers.
On the client just do an XMLHttpRequest for whatever and shove it back down the web socket to the proxy server. Done, Right? I'll do a little experiment when i have time...
http://developer.sonymobile.com/wp/2011/12/07/ice-cream-sand...
https://github.com/LearnBoost/socket.io/issues/193
Pretty annoying.
On a side note, UI related, when I am on this page: http://tether.com/iphone/ and click "Order Now" at the top right, the modal window opens behind the YouTube video.