shadowsocksrr / electron-ssr

Shadowsocksr client using electron
MIT License
1.73k stars 510 forks source link

mac 下,使用pac模式时, chrome 要等待 10 秒才能访问被墙的网站(需要更多的macOS测试) #53

Closed vocaloidchina closed 4 years ago

vocaloidchina commented 4 years ago

MACOS 版本:10.15

所使用的软件:electron-ssr v0.2.7

chrome 版本:chrome80

具体症状:在软件中使用 pac 代理模式时(打开的瞬间在系统的代理设置中就可以看到勾选了”自动配置代理“选项,里面填写的地址是 pac 地址),打开 chrome 需要等待 10 秒钟才能正常使用,否则访问那些网站左下角会一直卡在”正在连接“。软件日志无异常。使用 safari 无异常。使用”全局代理“(在系统中显示为”socks 代理“)无异常。

dns 设置为 223.5.5.5,在系统中改为 8.8.8.8 无效果。

在虚拟机开了一台 mac 10.13 的机子,同样情况。

xVanTuring commented 4 years ago

Make sure you have a cached pac.txt in ~/.config/electron-ssr, it takes a lot of time downloading it. You can use the Update PAC command to update it.

xVanTuring commented 4 years ago

https://raw.githubusercontent.com/shadowsocksrr/pac.txt/pac/pac.txt Here is the raw url, if you can download it ,tray save it to ~/.config/electron-ssr as pac.txt

vocaloidchina commented 4 years ago

@xVanTuring thank you for your reply

I confirmed that I already have the pac file locally, and its address is under/users/<user name>/ library/application support/electron-ssr, but I still have this problem.

And I noticed that the pac proxy address in the "Automatically configure proxy" option address is 127.0.0.1:2333/proxy.pac. I accessed this address immediately when I opened chrome. The pac file can be downloaded normally and the content is complete .But when I visit google, chrome is still stuck at "Connecting". So I don't think it is caused by the program downloading the pac file. And this problem will only appear in chrome, I can visit the webpage in safari immediately.

I tried to run electron-ssr on another of my windows10 computers, this problem cannot be reproduced

I used to suspect a bug in chrome, but I tried another ssr software: ShadowsocksX-NG-R, when I using "pac" Mode it works perfectly.

Here is my all logs

2020-02-18 19:50:02:792 [info] Checking for update
2020-02-18 19:50:04:098 [info] last update time: Tue Feb 18 2020 19:50:04 GMT-0800 (PST)
2020-02-18 19:50:05:766 [info] run command: python /Users/<user name>/Library/Application Support/electron-ssr/shadowsocksr/shadowsocks/local.py -s <server ip> -p <server port> -k <password> -m aes-256-ctr -O auth_aes128_md5 -o tls1.2_ticket_fastauth -g download.windowsupdate.com -b 127.0.0.1 -l 1080
2020-02-18 19:50:06:032 [info] pac server listen at: 127.0.0.1:8090
2020-02-18 19:50:07:083 [info] next subscribe update time: Wed Feb 19 2020 19:50:04 GMT-0800 (PST)
2020-02-18 19:50:10:250 [error] 2020-02-18 19:50:10 INFO     util.py:85 loading libcrypto from /usr/lib/libcrypto.dylib

2020-02-18 19:50:10:257 [error] 2020-02-18 19:50:10 INFO     local.py:50 local start with protocol[auth_aes128_md5] password [removed] method [aes-256-ctr] obfs [tls1.2_ticket_fastauth] obfs_param [download.windowsupdate.com]
2020-02-18 19:50:10 INFO     local.py:54 starting local at 127.0.0.1:1080

2020-02-18 19:50:10:293 [error] 2020-02-18 19:50:10 INFO     asyncdns.py:324 dns server: [('192.168.40.2', 53)]

2020-02-18 19:50:21:176 [info] Update for version 0.2.7 is not available (latest version: 0.2.7, downgrade is disallowed).

In the end, I think this problem should be widespread under the mac, because I installed the macOS system fresh, and this problem still exists.

Looking forward to your reply Thx

xVanTuring commented 4 years ago

It's really weird, Maybe the pac content matters. You can try comparing the two pac files to see what's going on.

vocaloidchina commented 4 years ago

@xVanTuring Hello! I follow what you said, first access 127.0.0.1:2333/proxy.pac and download the proxy.pac file proxy.zip

Then I extracted the pac.txt file under electron-ssr folder pac.zip

I used Beyond Compare software to compare the differences between the two files (the pac.txt extracted from the electron-ssr directory on the left and the proxy.pac file downloaded from 127.0.0.1:2333/proxy.pac on the right),The only difference in the final comparison is shown below. 捕获1

By the way, I recorded a gif to represent the scene when something went wrong.(This gif may stand still at the beginning, please be patient.) GIF

Looking forward to your reply Thx

xVanTuring commented 4 years ago

The __PROXYY__ will be replaced by electron-ssr while responsing the http requests, so that's not the problem. https://github.com/shadowsocksrr/electron-ssr/blob/28cc5d27bd747854438878d920e45ff36ca4a1b3/src/main/pac.js#L60 I will install a hack macOS myself to check it ASAP. Also have you ever tried it on firefox? About comparing, I actually mean comparing it with the one from ShadowsocksX-NG-R

xVanTuring commented 4 years ago

@vocaloidchina Bad news! After testing on macOS 10.13.6, chrome 80, electron-ssr 2.7 with pac mode everything works! Couldn't find any delay problems.😟

vocaloidchina commented 4 years ago

@xVanTuring Thank you for your reply.

Today I explored carefully. I first deleted all the electron-ssr directories, and then added the shadowsocksr server separately, and found that it worked fine. After that I used the "Subscription" function, but after I added the subscription link and update it(only the subscription link was added, others such as the automatic update subscription setting is the default), I selected a server in the subscription, and this problem appeared again!

Other details: There are nearly 70 servers in the subscription; the subscription link server is about 200ms behind my computer.

Some strange phenomenon: I tried to use your newly released version 0.3.0, and although many errors popped up on my mac, I found a strange phenomenon: the first two times when I just started the application, whenever the top right After the "Successfully Update Subscription" pops up in the corner (in version 0.2.7, my mac cannot receive any information from electron-ssr, even if I have allowed the message to pop up), my chrome can access the website normally, otherwise it keeps stuck at "Connecting ". But this problem disappeared after opening the electron-ssr program repeatedly. It looks like I can directly access the website by opening electron-ssr version 0.3.0.

However, the problem occasionally recurs in version 0.3.0.

Regarding whether the firefox that you said is working normally or the ShadowsocksX-NG-R software is running correctly, I will continue to try later and upload the corresponding gif. I'm sorry that I have other things to deal with in recent days and I haven't been able to follow up on this issue in time.

Looking forward to your reply Thx

vocaloidchina commented 4 years ago

@xVanTuring I have performed some tests these days and the results are as follows

Using Firefox, works fine firefox

Using Chrome, works abnormally GIF2

Using ShadowsocksX-NG-R, works fine GIF3

Using safari, works fine GIF4

By the way, I found that the 0.3.0 version can only work normally when it is started for the first time, and it still does not work normally when it is repeatedly turned on later.

At last,some other inappropriate content has been sent to your mailbox (xVanTuring@outlook.com), please check it out. Thanks

xVanTuring commented 4 years ago

I'm dropping the support of v0.2.7, so I 'll only try fixing the problem in v0.3.0. Hope that works for you.😏

xVanTuring commented 4 years ago

@vocaloidchina One more question, after accessing google.com page successfully, will the delay occur if you full reload it in chrome

vocaloidchina commented 4 years ago

@xVanTuring Hello I have made some new discoveries. It still seems to be a subscription issue. After I cancelled the update subscription in the 0.3.0 preview version you released, it seems to work fine. By the way, there are still some problems with v0.3.0 subscriptions. For example, I checked "Check subscriptions every day" but in fact the program still detects subscription updates when it is opened. Regarding the full refresh page you said, there will also be a delay problem. I used cmd + shift + Rto refresh the page hard in chrome. It seems that I cannot reproduce the problem you said.😟

xVanTuring commented 4 years ago

About the updating subscription while app launches, it actually exists for a very long time, I'm currently looking for a better solution.

xVanTuring commented 4 years ago

@vocaloidchina The problem becomes weird now, I've replaced the pac.txt link with a cdn in the next preview release, hope that will help, I will send it to your email, make sure you click the update pac menu item in the tray first.

If the problem keeps, maybe we should let it be, it must be some kind of super power!!!! 🙄

vocaloidchina commented 4 years ago

@xVanTuring Hello After trying your 0.3.0-2 version, after my first test, it looks like this problem has been solved! But because the problem was so strange, I decided to keep watching for the next few days to see if the problem would occur again. In addition, it seems that the 0.3.0 version has a serious problem: the python process does not exit after exiting the client, so opening the client again will cause the problem of port occupation.

xVanTuring commented 4 years ago

I noticed that too, I will fix that ASAP.

vocaloidchina commented 4 years ago

@xVanTuring It seems that there is another problem with v0.3.0 on mac: after a fresh installation or deleting the configuration file generated by the old version, proxy_conf_helper cannot be installed

When launching the application, the following window will pop up 捕获 But in the log shows that the installation was failed.

2020-02-25 06:55:30:433 [error] Failed to install mac proxy_conf_helper
2020-02-25 06:55:30:654 [error] undefined
vocaloidchina commented 4 years ago

@xVanTuring There is bad news!😟 Although it seems that the 0.3.0-2 version is working properly, when I restart the mac, I find that the pac function completely fails. No matter how long I wait, I cannot use pac mode to access the banned website. I can't even open http://127.0.0.1:2333/proxy.pac in my browser,the browser reported timeout when opening the URL. In the software log, it gives the following error

2020-02-26 04:21:36:626 [error] {
  constructor: 'TypeError',
  stack: 'TypeError: r.replace is not a function\n    at pe ' +
    '(/Users/<user name>/Desktop/electron-ssr ' +
    '2.app/Contents/Resources/app.asar/background.js:5:105344)'
}
xVanTuring commented 4 years ago

@vocaloidchina I met the same problem in Linux now. Fixing.

xVanTuring commented 4 years ago

@vocaloidchina That problem is now fixed. https://github.com/xVanTuring/rss-nortcele/commit/d9c9661a686fd7376f4682af2c0f3c362a665714 And also a preview release will be available at my fork, You can have a test it when you have time.

vocaloidchina commented 4 years ago

@xVanTuring Thank you! It looks like the problem has been solved. In addition, after my test, the problem of delaying 10 seconds to open the banned website has been resolved. Thank you for your work these days!