Switchyomega: Autoswitch to system proxy

Created on 15 Feb 2015  Β·  12Comments  Β·  Source: FelisCatus/SwitchyOmega

I usually use Tor as my go to proxy for getting round blocks etc, but sometimes I want to appear to be in a specific country, for which I use the ZenMate extension. This doesn't work with SwitchyOmega running, so I have to turn it to system proxy. Is it possible to do this automatically on the relevant websites using autoswitch rules?

Most helpful comment

This is due to technical differences between "Direct" and "System Proxy". A direct connection is a possible value of proxy settings, while "System Proxy" is the absence of proxy settings and thus the settings of other extensions and settings from system environment can come into effect.

The Auto Switch mode is one combined value containing all the conditions and their results, instead of some kind of "automatic switching" between these proxy settings. Such combination requires the exact value of the results, like "DIRECT" or "SOCKS5 127.0.0.1:1080". Combing "System Proxy" isn't possible because "System Proxy" is the absence of such setting value. You can combine apple juice and lemonade into a mixed drink, but you can't combine apple juice and an empty glass into anything.

In one word, including "System Proxy" in Auto Switch is not possible, while including the "effective proxy settings" provided by other extensions could be possible, by saving and using the "External Profile" as shown in the screenshot above. Such "effective proxy settings" can only be read when SwitchyOmega itself does not set the settings (i.e. in "System Proxy" mode), and thus cannot react to changes of the proxy settings by other extensions when SwitchyOmega itself is in "Auto Switch" mode.

All 12 comments

This feature is not possible due to limitations of PAC script and the way Chrome proxy settings work.

However, it is possible to re-install the other extension in question, giving it higher priority so that it would override the settings provided by SwitchyOmega once enabled. The priority policy is set by Chrome and cannot be controlled by extensions. Only one extension can set the proxy settings and no collaboration is possible except voluntarily give the control back (e.g. "System Proxy" in SwitchyOmega).

It would be possible on SwitchyOmega's side to "read" the settings provided by other extensions, but doing so would be impossible when SwitchyOmega itself set the proxy settings (again, due to internals in Chrome.) Such limitations effectively prevented SwitchyOmega from "merging" the settings on its own side.

But when I click on the SwitchyOmega icon a list of proxy settings comes up, including system proxy, which lets the other extension function, isn't it possible to just add in a feature to autoswitch to that setting? Much like I can autoswitch to "direct".
capture

This is due to technical differences between "Direct" and "System Proxy". A direct connection is a possible value of proxy settings, while "System Proxy" is the absence of proxy settings and thus the settings of other extensions and settings from system environment can come into effect.

The Auto Switch mode is one combined value containing all the conditions and their results, instead of some kind of "automatic switching" between these proxy settings. Such combination requires the exact value of the results, like "DIRECT" or "SOCKS5 127.0.0.1:1080". Combing "System Proxy" isn't possible because "System Proxy" is the absence of such setting value. You can combine apple juice and lemonade into a mixed drink, but you can't combine apple juice and an empty glass into anything.

In one word, including "System Proxy" in Auto Switch is not possible, while including the "effective proxy settings" provided by other extensions could be possible, by saving and using the "External Profile" as shown in the screenshot above. Such "effective proxy settings" can only be read when SwitchyOmega itself does not set the settings (i.e. in "System Proxy" mode), and thus cannot react to changes of the proxy settings by other extensions when SwitchyOmega itself is in "Auto Switch" mode.

Ok, thanks, now I get it. And now I want to try apple juice mixed with lemonade. Cheers.

So if I understand you correctly, it would actually be possible to auto switch TO system proxy, but in order to do so you would necessarily have to leave auto switch mode because otherwise you wouldn't have an absence of proxy settings, and so it's not possible to auto switch back? By removing proxy settings with system proxy you're also removing any information that would let the extension switch back later, right?

No. Auto Switch is not technically switching. No changes of proxy settings happen as long as you stay in Auto Switch mode. When you click on the menu to select "Auto Switch", SwitchyOmega compiles its rules and other profiles needed in "Auto Switch" to a proxy script, which is set as the proxy settings. From this point, Chrome does all the network related stuff, and SwitchyOmega won't even have a chance to get the URLs of the websites _before_ the network request is sent. After the website is loaded into the tabs, SwitchyOmega tries to "mimic" the algorithm used by Chrome and set the icon color based on its own calculation, in order to give users some idea about what is happening internally.

So, SwitchyOmega is actually a proxy script maker and manager, right?

Ok, I think I understand now. Thanks for taking the time to explain.

@Hs-Yeah Yes. SwitchyOmega is a PAC script generator in a sense. The /omega-pac sub-project contains all the code required to compile a profile to PAC script. This functionality is provided for every profile as "Export PAC" button on the top of every profile in the extension. Of course, there are also sub-projects related to settings related processing and the Web interface for configuring options, because generating a PAC script itself isn't so interesting. Anyway, I would describe SwitchyOmega as a tool for configuring proxy settings but more advanced than the system-provided proxy settings dialog.

@hr9241 You are welcome. You are actually helping the project by asking such questions, because it would eventually add something to the project documentation. As SwitchyOmega have grown more and more complicated technically, we will need some design documents, just like in the Chromium project. Now I am thinking about summarizing what I have said and create an article in the project wiki. Maybe under the title "How Switch Profiles Work". :)

Does that mean that you cannot read/access either the current pac file or current system proxy and append it to a system proxy profile ?

Things are pretty straightforward with environment-provided settings, such as the settings in Internet Explorer, Linux DEs, or OS X Settings. It is NOT possible to read these proxy settings, unless we introduce platform-specific code to the project.

Another source would be the proxy settings provided by other extensions. It is possible to read the effective proxy settings as provided by the extension with highest priority. The settings provided by any other extension with less priority are overridden, ignored and hidden.

  • When SwitchyOmega itself is effective, that would be its own settings, which is useless.

    • This is the main reason that Auto Switch cannot "give control" to other extensions by condition.

  • When SwitchyOmega is not effective, it has access to the effective settings by another extension.

    • You may save the effective settings for later use, by selecting "External Profile" in the popup menu.

    • Such saved profiles can be used with Auto Switch in SwitchyOmega just like any other profile.

    • However, saved profiles are not "connected" with other extensions in any sense. They are just snapshots of the settings at the moment of creation.

Was this page helpful?
0 / 5 - 0 ratings