This achieves a non-jailbroken, non-rooted, poor-man’s network tether. Here’s the catch, Gelf needs to run on a device inside each target network. Gelf functions as the L2 tunnel end-points, and the L1 emulation: achieved through an HTTP client.
Example (using EC2)
- Run Gelf on an EC2 host (server1)
- Run Gelf on your Internet-handicapped laptop (server2)
- Create an ad-hoc network from your laptop to an iPhone
- Browse to the Gelf webserver (server2) from the iPhone
- Use the web interface and enter the IP/port of server1
Result: you can route traffic between server1/server2. Simple? I hope so.
Requirements: Cherrypy >= 3.2.2, PyCrypto (for optional encrypted L2 links), WebSockets-for-Python
server1$ sudo ./gelf.py --host 0.0.0.0 --enc 7001 [Gelf] Encryption key: b04c96f0e62fd14424e7e58e3d8ba957 [Gelf] Created interface: tap0 [Gelf] Relay listening: 0.0.0.0 7001 server1$ sudo ifconfig tap0 10.10.10.1 netmask 255.255.255.0
server2$ sudo ./gelf.py --host 0.0.0.0 --key b04c96f0e62fd14424e7e58e3d8ba957 7001 [Gelf] Encryption enabled [Gelf] Created interface: tap0 [Gelf] Relay listening: 0.0.0.0 7001 server2$ sudo ifconfig tap0 10.10.10.2 netmask 255.255.255.0
Now comes the tricky part. Open a web browser and navigate to server1’s web server. This will automatically open a WebSocket to server1. Use the interface to add a WebSocket to server2.
server2$ ping -c3 10.10.10.1 PING 10.10.10.1 (10.10.10.1) 56(84) bytes of data. 64 bytes from 10.10.10.1: icmp_req=1 ttl=64 time=9.17 ms 64 bytes from 10.10.10.1: icmp_req=2 ttl=64 time=3.50 ms 64 bytes from 10.10.10.1: icmp_req=3 ttl=64 time=3.83 ms --- 10.10.10.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2004ms rtt min/avg/max/mdev = 3.504/5.505/9.175/2.599 ms server2$ arp -an [...] ? (10.10.10.1) at 4a:af:22:08:83:0f [ether] on tap0
The version of WebKit in MobileSafari does not support RFC 6455. So the primary use case is defunct. However, RFC6455 is supported in the WebKit nightly build.
Read buffers are not optimized. The configured read buffer should set the tap interface’s MTU. This should be optimized with respect to HTTP as a transport.
Download / Clone / Fork
Feedback is certainly welcomed! https://github.com/theopolis/gelf