xaberus / vscode-remote-oss

Remote development for OSS Builds of VSCode like VSCodium
Other
99 stars 7 forks source link

Port forwarding not working #6

Closed CGamesPlay closed 1 year ago

CGamesPlay commented 1 year ago

It would be awesome to be able to set up port forwarding using the built-in port forwarding behavior. This works with the official VSCode dev containers extension, and that implementation does not involve exposing ports on the Docker container, so it's using some method of the REH directly. In order to enable the port forwarding view, we have to include this line in the doResolve function:

        // Enable ports view
        vscode.commands.executeCommand("setContext", "forwardedPortsViewEnabled", true);

Now the view shows up, however adding a port fails without an error message. I'm not sure why, since Open Remote (SSH) doesn't seem to do anything other than this to get tunnels to work (it does have code for creating tunnels, but it doesn't appear to be hooked to any relevant VSCode interfaces). Further, the documentation for the tunnelFactory method indicates that it's optional.

CGamesPlay commented 1 year ago

Actually, I stand corrected. I tested this on another REH (one running on a bare metal machine over SSH), and with just this proposed change, port forwarding is working. Something in my other configuration resulted in it failing with no error, but I believe that puts it out of the scope of Remote OSS

xaberus commented 1 year ago

@CGamesPlay Sorry for taking so long to reply. The default "tunnels" VSCode creates run as channels over the multiplexed single (i.e., SSH) tunnel. So you have a single SSH channel that contains several multiplexed JS channels... I guess this use case is useful enough, even though you sacrifice latency (and bandwidth) this way. The SSH extension can sidestep this limitation by creating actual SSH channels and plugging them into VSCode. This of course is out of the scope of this extension, because it has no notion of the main SSH tunnel that could be used to create such channels.

I will test your PR and probably merge it, as the change is minimal.