nythepegasus / SideJITServer

A JIT enabler for iOS 17 with a Windows/macOS computer on the same WiFi!
GNU General Public License v3.0
245 stars 17 forks source link

Port Forwarding / Remote Support #48

Open SilverVRCode opened 1 month ago

SilverVRCode commented 1 month ago

Hello!

I've been attempting to work on getting this application to work on an iPad using a different network. I've gotten pretty far with this so far; I enabled port forwarding, changed the IP in the shortcut to be the router IP and the forwarded port. It currently works on my own network through this IP, however, when changing networks, it usually repeats one of two errors:

"Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application." (And desktop error is OSError: [WinError 10051] A socket operation was attempted to an unreachable network) Or, "{"ERROR":"Could not find device!"}" (Unsure of desktop error here)

This could work, and I'm hoping that I can help create a solution for this. Any help is appreciated!

justing6 commented 1 month ago

I’m looking for this functionality too. I’m on Windows 10 and SideJITServer works as expected over USB, but I run into mostly errors trying to use it over WiFi, same LAN or otherwise.

After running SideJITServer —pair and verifying the shortcuts works over USB, if I unplug from USB and try over WiFi I get an “Internal Server Error” from the Shortcut with the SideJITServer giving me a the same “A socket operation was attempted to an unreachable network” as the OP. I don’t understand why I get this error because my iPad is on the same subnet as the server and I can even ping the iPad from the same command prompt.

If I stop the SideJITServer after pairing and just run it again with “SideJITServer”, I get nothing but "{"ERROR":"Could not find device!"}" from the Shortcut.

I actually had it working over WiFi (at least on the same subnet) for a little bit when I first tried it, but then it stopped working and I can’t get it to work again. The old behavior I got was: Internal server error occasionally, but stopping the SideJITServer with ctrl+c and running “SideJITServer” again caused the shortcut to work. However, whenever I tried from a different subnet (e.g. a different VLAN on my network or from a VPN), I always got the "{"ERROR":"Could not find device!"}" error instead.

I tested first on my same machine that had iTunes/AltServer running, then on a different Windows machine that does not have iTunes or AltStore. I get the same behavior on both.

justing6 commented 1 month ago

tl;dr @SilverVRCode if you’re trying to use SideJITServer on a different VLAN/subnet on the same network, using something like Avahi to reflect multicast traffic between your iOS device’s network and the SideJITServer’s network should do the trick. However if you’re trying to do this over a VPN from the iOS device, it won’t work as there’s no iOS VPN that supports multicast traffic (at least to my knowledge).

So after more testing I think I hit the same wall as everyone else. The good news is I fixed my issue of SideJITServer not working over the same WiFi network. It seems the trick to make it constant for me is to wait until the machine sees the iPad over Bonjour (either it popping up in iTunes or in AltServer) and THEN running the SideJITServer, or restarting it if it’s already running. This seems fairly consistent.

Without digging too much into the source code of pymobiledevice3, it looks like the reason this doesn’t work cross subnet is it still uses Bonjour, even if you’re connecting to the direct IP of the SideJITServer. If your iOS device isn’t detected over Bonjour, then SideJITServer won’t work. This means that cross networks (even in two different locations as long as you control the routers and can run a Layer 2 VPN) can function as long as your reflect multicast traffic. However, getting this to work over straight VPN from the iPad seems impossible, as I haven’t found a single layer 2 VPN that iOS supports. If multicast traffic isn’t going over your VPN, then SideJITServer won’t work.

While I could use a pocket router (like a raspberry pi) to build a layer 2 VPN and connect the iPad to it when I’m away from home, this ultimately seems more complicated and finicky than just having a small windows device or a spare laptop with me when I travel.

takov751 commented 1 month ago

With that said i was looking up pymobiledevice3 for a solution and found that if an api endpoint exposed which would initiate a tunnel over mobdev2 for example this would be a good solution over a vpn, however tunnel over VPN is highly unstable or at least with my early tests

Other solution was to install an mDNS relay between networks, however that is another way to disaster

SilverVRCode commented 3 weeks ago

Hello!

"Without digging too much into the source code of pymobiledevice3, it looks like the reason this doesn’t work cross subnet is it still uses Bonjour, even if you’re connecting to the direct IP of the SideJITServer. If your iOS device isn’t detected over Bonjour, then SideJITServer won’t work"

I see why this doesn't work now. However, an app is actually not needed for a VPN method! In iOS settings, there is an option to connect to a server as a VPN.

image

The setting is in General > VPN & Device Management > VPN, which has many connection settings within. This could be useful.

EDIT: In the "Type" setting, there is an option for L2TP (Level 2 Tunnelling Protocol)!

nololler commented 1 day ago

so is there a solution to this issue as of now? any updates?