-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can’t get it working #1
Comments
Thanks for the bug report! I just tried your setup on my Mac using an ad-hoc (computer) network, and you're right, it doesn't work at all. I'm not sure what is going on, exactly - the Mac doesn't even attempt to retrieve the wpad.dat file when connected to the ad-hoc network; it won't even work if you set the SOCKS5 proxy manually. Something is preventing the Mac from believing that it has a network connection. However, it works fine if you use Firefox on your Mac, as you can set proxy settings in Firefox independent of your system settings. I also just pushed a fix that makes the wpad work properly in Firefox (but before that fix, setting the SOCKS5 proxy URL manually also worked). (The reason I didn't notice this before - I use Firefox almost exclusively, and the last time I tested with the macOS system proxy I was using a throttled mobile hotspot rather than an ad hoc network, so I didn't notice this problem). |
After some more testing, here's a workaround (I'll stress that this is a bug in macOS's network handling - not in my script):
In testing, this caused Safari and various system services to route through the proxy, as expected. (I didn't test Chrome, but since it uses the system proxy settings it would probably work too). Technical detail: it appears that without a Router or DNS setting, macOS's URL APIs consider you offline, even though you can freely access anything under your subnet without a router (which would include the iPhone running the proxy). The Router setting is used for packets that need to be routed outside of your subnet, e.g. ones going to the Internet; if it's missing, you can't route packets directly to the Internet. I guess they didn't consider the case where you would exclusively proxy through a device on the local network... (Note that using your own IP as a Router setting is technically invalid and definitely won't magically route your packets to the Internet, but it seems to satisfy macOS so that's enough.) |
Hey! Thanks for the quick and detailed response. I got it working in Firefox and with Proxifier too. Would like to get System Services and Mail running, which Proxifier does not seem to be able to handle. Either way, unfortunately your workaround did not work for me. I just lost all connectivity. Perhaps to be expected, if it's technically invalid. Thank you anyway for trying!
|
Hmm, interesting. I tested on macOS 10.14. Maybe it's changed in a different OS. One thing you could try is to set the Router to the IP of your iPhone rather than the IP of the computer itself. That won't route anything either (since the iPhone won't try to route your packets in an ad hoc network), but it might be less invalid... |
I am experiencing this issue as well. I'm able to ping the iPhone from the Mac on the ad hoc network and even manually open a socket connection to the SOCKS proxy, however Chrome/Safari/curl/etc. don't work after setting the SOCKS proxy setting in the network settings. I've tried with the router address set to both the laptop and the phone with no difference. |
If I manually specify the proxy on the command line to curl I get a little further but something is breaking:
|
Same issue here on macOS Ventura Version 13.3.1 (22E261). Thnak you |
Thanks for the ping. I believe I have a solution. For some background: I have been using this script for the past few years, even as recently as a few weeks ago. I usually use it from a tethered-but-throttled connection, i.e. when my provider permits tethering but at speeds far below what my phone can achieve. In this scenario, macOS connects to the iPhone hotspot, so it correctly assesses the network as reachable. However, I believe everyone in this thread has been using it in the non-tethering setup, where you e.g. create an ad-hoc network on your Mac, then connect to that network from the iPhone and launch the SOCKS proxy. In this scenario, macOS assesses the network as being unable to reach the internet, even when a proxy server is set. Unfortunately, this will prevent any application that relies on the macOS networking APIs from reaching Internet sites. I usually use Firefox, which side-steps this issue because uses an independent proxy configuration and an independent network reachability check, so it will work properly if a proxy is set. However, this is not a complete solution. I believe we can trick the reachability check. In #1 (comment) I mentioned setting the Router of the connection. That doesn't appear to be sufficient anymore. What I did now was to also set the DNS Server to the phone. It doesn't matter that the phone has no DNS server running. The combination of setting the Router and the DNS Server seems to be enough to override the reachability check. I have verified this on macOS 12.6.5. In detail, here's what you do:
With any luck, Safari should start working. Please let me know if these instructions work for you. (P.S. Make sure to undo those changes when you switch back to a regular WiFi connection!) 1: If no IPv4 address was displayed, you can just choose a random 169.254.y.z address (y, z between 1 and 254), as long as it isn't the address of your iPhone. |
Hey man! Thanks for this script. I can’t seem to get it working with ad-hoc on my Mac. Here’s what I do:
Am I doing something wrong? Thanks for your help! I would love to make this work.
The text was updated successfully, but these errors were encountered: