magic-wormhole.rs icon indicating copy to clipboard operation
magic-wormhole.rs copied to clipboard

Feature Request: socket tunneling like ngrok

Open TimothyFitz opened this issue 6 years ago • 6 comments
trafficstars

Using Magic Wormhole as a replacement for tools like ngrok, to tunnel raw sockets and/or HTTP traffic, would be really useful.

From a cursory glance at the underlying implementation, this seem doable on top of the existing model.

TimothyFitz avatar Mar 26 '19 19:03 TimothyFitz

I think tunneling a TCP port over to another machine should be doable. This would probably use a new APPID with its own custom little client-client protocol. This then needs to initialize the transit tunnel. The only thing to figure out there is who is "sender" and who is "receiver", as there is no such concept in a bidirectional tunnel.

All of this gives us a TCP connection, but I don't know how to expose it as "tunnel" to the OS.

@TimothyFitz I don't know ngrok, what is your exact use case? The only tunneling I've ever done was over SSH, and I don't know why I'd ever need something else.

piegamesde avatar Nov 05 '20 11:11 piegamesde

I hadn't heard of ngrok - neat little function, and yeah, it seems like this should be free & do-able. One question: what would the public IP of the tunneled socket be?

dylanmc avatar Jan 26 '21 23:01 dylanmc

I don't know if I understand correctly, but there should be no public IP address, only localhost.

piegamesde avatar Jan 27 '21 09:01 piegamesde

One of the main cool things ngrok does is make a local service available externally. In ngrok's case, it's via a unique hostname in a domain they control (on their screen-demo it's katesapp.ngrok.io). I was wondering what @TimothyFitz was suggesting for the public IP of his feature request would be. If it's to be run on the wormmole server, that's more heavy lifting on the server side than wormhole currently does, but maybe I'm wrong - that it's basically the same. I don't yet understand how the rendezvous / network connection mechanism works.

dylanmc avatar Jan 27 '21 16:01 dylanmc

I see that there are two different concepts and use cases here, so I've split up the issue into #109. Let's talk about ngrok-like features only here.

piegamesde avatar Jan 27 '21 17:01 piegamesde

We now have an experimental implementation of port forwarding merged. Please give it a try and provide feedback. If you have an interesting use case for this, consider sharing it and I'll add it to the documentation eventually. Notable port forwarding setups that have already been tried (more or less successfully):

  • "Open to LAN" Minecraft Server, but across the internet
  • Interactively sharing parts of a folder hierarchy with miniserve
  • Ad-hoc web server testing
  • Tmux/TTY screen sharing
  • Rsync between machines that don't SSH
  • SSH between machines that otherwise can't reach each other

piegamesde avatar Feb 28 '22 14:02 piegamesde