FelisCatus / SwitchyOmega

Manage and switch between multiple proxies quickly & easily.
GNU General Public License v3.0
21.29k stars 3.19k forks source link

Proxy failover #578

Open hillz1 opened 9 years ago

hillz1 commented 9 years ago

I have 5 different socks5 proxies:

192.168.8.1:1080 192.168.8.1:1081 192.168.8.1:1082 192.168.8.1:1083 192.168.8.1:1084

I want to automatically switch to another proxy when one of my proxies is dead, how can I do that?

celeron533 commented 9 years ago

I think current version of SO does not support the 'smart switch' or 'load balancing' among a collection of profiles.

PS. If you are using Shadowsocks, the latest C# client (2.5.6) supports 'high availability' server settings which will automatically select the best server by connection qualities.

hillz1 commented 9 years ago

Do you mean the current extension ? I'm using google chrome and this extension, this extension is awesome but it's just missing one single feature, that is switching between proxies when one fails, it would be perfect if it had that feature implemented

FelisCatus commented 9 years ago

For now you can create a PAC profile instead and use the following script:

function FindProxyForURL(url, host) {
  return "SOCKS5 192.168.8.1:1080; SOCKS5 192.168.8.1:1081; SOCKS5 192.168.8.1:1082; SOCKS5 192.168.8.1:1083; SOCKS5 192.168.8.1:1084";
}

Configuration interface for fail-over is more complicated and requires some change in PAC generation code. Suggestions on the interface design (e.g. buttons and inputs) for the feature are welcome.

hillz1 commented 9 years ago

Too bad that script doesn't work, I can't connect to any sites with that. I have some URLs that need to be excluded as well.

FelisCatus commented 9 years ago

@hillz1 The script was written for HTTP proxies instead of SOCKS5 proxies, which is the reason. Sorry for that. I've modified the script above to read SOCKS5 for each proxy entry. Please try again.

In SwitchyOmega, a PAC profile can also be used in Switch Profiles. You can just create a new Switch Profile, and set its default profile to to the PAC one. After that, you are free to add more rules for all URLs that you want to exclude, and point them to Direct Connection.

hillz1 commented 9 years ago

Thanks that works pretty well now

dyingjedi commented 8 years ago

`For now you can create a PAC profile instead and use the following script:

function FindProxyForURL(url, host) { return "SOCKS5 192.168.8.1:1080; SOCKS5 192.168.8.1:1081; SOCKS5 192.168.8.1:1082; SOCKS5 192.168.8.1:1083; SOCKS5 192.168.8.1:1084"; }`

So could use this for HTTP instead for my five different HTTP proxies?

`For now you can create a PAC profile instead and use the following script:

function FindProxyForURL(url, host) { return "HTTP 192.168.8.1:1080; HTTP 192.168.8.1:1081; HTTP 192.168.8.1:1082; HTTP 192.168.8.1:1083; HTTP 192.168.8.1:1084"; }`

Im guessing this would be correct. do i save it mypersonalhomeproxies.pac set it up on my gdrive or something as a pointer to pastbin etc?

Justin Cram DyingJedi

FelisCatus commented 8 years ago

PAC scripts are managed in SwitchyOmega by creating PAC Profiles. Use the New Profile entry in the left side menu, and choose PAC profile in the popup. It should create a profile with a large text area for script editing. The script contents are saved in SwitchOmega and synchronized among devices.

Please note that HTTP proxies use PROXY keyword instead of HTTP. For your example, the script should be:

function FindProxyForURL(url, host) {
  return "PROXY 192.168.8.1:1080; PROXY 192.168.8.1:1081; PROXY 192.168.8.1:1082; PROXY 192.168.8.1:1083; PROXY 192.168.8.1:1084";
}

You can visit http://findproxyforurl.com/ or google for instructions if you have any questions regarding writing PAC scripts.

FelisCatus commented 7 years ago

Hi everyone. This issue has been blocked on interface design for a long time. Any idea on how you would like to input multiple proxies on the options page?

celeron533 commented 7 years ago

UI could be designed as: (there are some alignment problem in this mock-up) image

FelisCatus commented 7 years ago

Interesting, but considering we still have a Show Advanced table there, wouldn't it be too much to have such add/delete buttons and rows for every scheme?

hillz1 commented 7 years ago

One day SwitchyOmega crashed on my pc and I had to write all the rules from scratch, it'd be very helpful if we had an automatic backup feature to dropbox.

FelisCatus commented 7 years ago

@hillz1 I would appreciate it if you could create another issue for this.

celeron533 commented 7 years ago

mock up for Show Advanced image

FelisCatus commented 7 years ago

Great mockup, thanks. I noticed you are using Excel as a design tool though. Well that's not a bad thing since the whole Metro UI thing could be designed using the same tool. :wink: This definitely gets the idea of multiple proxies right, but the average user could have problems figuring it out that the proxies are used as fail-overs instead of random or sequential. Also, I feel like the interface is a little bit overwhelming since we now have a lot of fields and buttons.

Another option would be a popup, just like what we did with username & password. In that case, we can drop the protocol/server/port columns and just have one button for customizing the proxies. In that popup window, we can explain that those proxies are used in a failover fashion. This allow new users to discover the feature instead of having to find all over the web and end up here.

Mockup for initial interface, where the plus button would open a popup for fail over.

image

(The popup window would be something like what @celeron533 proposed, but with more explanation. The four schemes have separate popups.)

Mock up for multiple proxies. The text cannot be edited, and the popup button now uses the "edit" icon instead of the "add" icon.

image

FelisCatus commented 7 years ago

Here's another proposal, which has a flat list of all proxy servers. Mock up:

image

Note that I've also tried to combine the feature request of falling back to DIRECT. Otherwise it is pretty much 1:1 relationship to PAC results (as compared to system proxy settings, Chrome's proxy data structure, etc.). We should also try to add a line saying "proxy servers are tried one by one from top to bottom" somewhere.

This feels more natural to set up multiple proxy servers at the expense of harder configuration of Schemes. However, using different proxies on different schemes is a rare case and people often get confused by the old "Show Advanced" settings even if they don't need it. Therefore, scheme is moved to the button there on the right hand side with a popup modal like this:

image

No functionality removed though, just moved to a different place.

loadwiki commented 7 years ago

I have a concern. "proxy servers are tried one by one from top to bottom" for each request sounds bad to performance. Does Chrome cache TCP connections with proxy servers? Is it possible to select the best one (according to ping quality) for each request, and update the selection regularly?

celeron533 commented 7 years ago

@loadwiki The core of SwitchyOmega is to generate an PAC file and may need to tweak it with user's interaction then regenerate the PAC. How to compile, use and consume the PAC is controlled by browser itself.

olloff commented 7 years ago

As you mentioned before,

confusing part about URLs are hidden behind the "Scheme" button.

is probably not the primary confusing part.

https://github.com/FelisCatus/SwitchyOmega/issues/578#issuecomment-307598067 proposal is great, it probably could save me from made such a novice mistake I made. I'd still add an HTTPS(TLS)-proxy tho but it would never use because of proxy priority.

It may sound illogical to you, but main confusing part here is PROTOCOL column itself. As a user I bound HTTP proxy protocol with http:// url scheme and HTTPS proxy protocol with https:// url scheme. Here's how that problem solved in FoxyProxy - to activate HTTPS-proxy user needs to do one additional click and he's informed about SSL proxy with small tooltip. Best way to treat that behavior is:

Btw, thanks for giving me a chance to put my five cent into the frame of discussion. Obviously I'm not a UX-designer, so I can't bring an expert opinion here, but I believe even users like me can be taught by guidance of UI.

FelisCatus commented 7 years ago

I agree with you on the protocol part. The technically-right-but-not-so-confusing way would be "HTTP Proxy (Secure)" or "HTTP Proxy over TLS" for these kind of proxies we are talking. They are rare though and usually can't be configured in System Proxy Settings so I there shouldn't be too many users using it, so it makes sense to use some specialized terms to avoid confusing with the URLs. Also, hiding it under a check like FoxyProxy also makes sense. I'm leaning toward the first option now but certainly, a tool tip can be shown regarding what they are and when they are not needed.

For the URL scheme selection, I will propose a third option, as shown below. image

First, it tries to make what it is explicit by avoiding confusing terms like scheme/protocol, but state clearly what it really is -- Use this proxy for what URLs. It defaults to "All URLs" which make sense in most setups and does not lead to confusion about what checkbox does what. Also, the whole UI design is focused on inputting the proxy itself first -- which is the most important -- and the URL configuration can come later as an additional configuration. If we put protocol and scheme together, there probably can be a moment where the user is thinking, "yeah, I have an HTTP proxy, but do I specify this in the first or second column?", which did lead to mis-configuration as I've seen earlier.

Now if you click on the dropdown, you will see:

image

This will be a multi-select drop-down. You can check whatever URLs you want to use and uncheck whatever you don't want to use. In case the user is confused, there's a help option which will popup a window. In that way we can still give the users all options at one click away, without making each row too thick.

Everyone, please feel free to join the conversation and leave your feedback.

FelisCatus commented 6 years ago

This issue could need a little bit feedback before we move on.