Settings

Theme

Show HN: web-p2p-tunnel, WebRTC+ServiceWorker HTTP tunnel to localhost

github.com

3 points by andrewmthomas87 2 years ago · 2 comments · 2 min read

Reader

Hey HN, web-p2p-tunnel is a hobby project I built over the past month.

It enables you to expose a local web server to devices on different networks. Nothing to install on the consuming devices - just a web browser. And no server in the middle. It uses a Service Worker to intercept HTTP requests and WebRTC to tunnel requests/responses directly between consuming devices and the device running the local web server.

To use: install the web-p2p-tunnel CLI program which receives requests, reverse proxies them, and tunnels responses. See the README for details. The website is deployed using Github Pages at https://tunnel.andrewt.io/. Additionally, a signaling server is deployed at https://signal.andrewt.io/.

I've tested on a number of OSs and browsers and with simple static web sites and more complicated apps. A lot of it just works, but there are kinks and edge cases and almost certainly bugs. Let me know :) Currently, there are no TURN servers configured, so connections may fail under certain network conditions.

Motivation: I built some media features using WebRTC at my last job. It's a bit of a pain to use, but it's a powerful technology. On the media side of things, however, P2P quickly turns into more of a client-server situation w/ something like an SFU for common use cases. From my understanding, WebTransport might become the better technology for this use case. This got me thinking about use cases that would specifically benefit from the P2P aspect of WebRTC, which led me here. I was inspired in part by this project: https://github.com/rtctunnel/rtctunnel.

Excited to share the project - I think it could be a useful dev tool. Feedback appreciated!

Sean-Der 2 years ago

Nice job!

This is much better then the status quo today. Even if things are E2E encrypted it is so wasteful that 'HTTP Tunnels' route through jump servers.

Cool thing about WebRTC is you can put this in a lot more places if you want.

Don't have anything constructive to add, but will share this on Pion Twitter/LinkedIn later. This has been on my short list of 'I really wish someone would build this' for a long time.

  • andrewmthomas87OP 2 years ago

    Thanks!

    Agreed on jump servers. Also a convenient architecture to productize and charge a subscription fee.

    I appreciate the positive feedback, especially from you. Your contributions to WebRTC are incredible - thank you!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection