Moehammered / switch-remote-play

Let the switch remotely play PC games (similar to steam link or remote play)
GNU General Public License v3.0
300 stars 13 forks source link

NATing SRP #67

Open mcking230 opened 1 year ago

mcking230 commented 1 year ago

Thank you very much for this program. On the local network it works fine, but I wanted to forward ports and play at work and I got an error Waiting for gamepad thread to shutdown... Then the program started connecting to the switch on port 10060, after forwarding this port, nothing works anyway изображение

Moehammered commented 1 year ago

Hi mate, thanks for providing a diagram, it helps when dealing with these kinds of issues. However, when making this program I designed it all around local networking because providing troubleshooting support for users over WAN or internet is not something I have the time for.

In saying that, I will try my best to provide the info you need, as well as some advice. Hopefully the discussion in this issue can be used by others trying to do something similar to you.

Client and Server Communication Overview

The client (Switch app) and the server (PC app) have a set of ports they expect and use to receive and send data for the stream to function. The many parts of the stream are split into separate communication channels and are as follows:

Judging from your diagram, I am guessing that while you may have forwarded the ports on one network, they aren't able to be received on the other network. Your workplace might be blocking the particular ports or have rules for inbound connections on certain ports. Regardless, things to try:

Alternative Approach - Setup a VPN at Home and Connect to it (Recommended)

The above is cumbersome, and if there are firewalls or port blocking rules in place at work that you have no control over, then you're kind of out of luck. Even if you can perform the port forwarding, it is usually advised to not port forward your home network (and your work place too) since it can lead to holes in your network security.

The alternative to all of this is to setup a VPN on your home network so you can connect to your home network and act as if you are part of the LAN. This is not too difficult if you use off the shelf solutions, but it is a lot to explain and my free time is very scarce (I'm writing this before bed and it's taken 40 minutes haha).

Examples of existing VPN solutions are things like wireguard or PiVPN. However, my personal recommendation is Tailscale. I use it myself to connect to my home network (for connecting to my dev machines at home to do work) and it is a wonderful solution with a lot of documentation on how to use and configure it.

Once you have Tailscale setup on your home network, you can then set it up to act as a 'router'. From there, you can do the following:

If done correctly, the above will make it so your Switch can communicate with your PC on your home network as if it were local to the Switch. No port forwarding required.

There's a lot of info to digest, I apologise for the wall of text. If I had free time I could probably write up a better description of how to help, but remote connections through the internet are a bit involved. What I've written though is plenty to go off and try (I believe), so I hope it leads to solving your problems. :)

Please I do ask that you attempt doing remote communication across the internet between a PC at home and a PC at work if you can to confirm that you're network setup is ready for remote connections.

I also ask anyone else seeking to perform remote connections and wanting help doing so, to try and follow the info above. I do not wish to provide support for streaming over the internet simply because it is a complex thing to explain, teach, and support. My free time is limited enough where I have no time to work on this app. Providing support on how to setup remote connections and setup VPNs is outside the scope of this app.

Thank you for your patience and understanding :)