zzzgydi / clash-verge

A Clash GUI based on tauri. Supports Windows, macOS and Linux.
20.84k stars 3.13k forks source link

MacOS v1.3.3自动检测网络出口设备进行设置系统代理,不成功。 #660

Open sysongyi opened 1 year ago

sysongyi commented 1 year ago
          v1.1.0支持自动检测网络出口设备进行设置系统代理啦

Originally posted by @zzzgydi in https://github.com/zzzgydi/clash-verge/issues/186#issuecomment-1257394009

sysongyi commented 1 year ago

日志信息: 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.206955+08:00" level=warning msg="To use xtls-rprx-vision, ensure your server is upgrade to Xray-core v1.8.0+" 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.207149+08:00" level=info msg="Geodata Loader mode: memconservative" 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.21339+08:00" level=info msg="Start initial GeoIP rule CN => DIRECT, records: 11507" 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.213518+08:00" level=info msg="Initial configuration complete, total time: 8ms" 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.213552+08:00" level=info msg="Sniffer is closed" 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.213886+08:00" level=info msg="Mixed(http+socks) proxy listening at: 127.0.0.1:7890" 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.213988+08:00" level=info msg="Start initial compatible provider default" 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.213996+08:00" level=info msg="RESTful API listening at: 127.0.0.1:19091" 2023-07-06 23:39:56 INFO - [clash]: time="2023-07-06T23:39:56.214019+08:00" level=info msg="Start initial compatible provider Proxy" 2023-07-06 23:41:11 ERROR - failed to parse string

zzzgydi commented 1 year ago

这个日志体现不出系统代理设置不成功,可以截图这里看看

image

以及打开mac的网络设置-代理里看看,设置到哪个网络设备上了

sysongyi commented 1 year ago

image

sysongyi commented 1 year ago

image

sysongyi commented 1 year ago

我打开mac的网络设置-代理里看了,没有任何网卡被设置代理。

zzzgydi commented 1 year ago
image

你把这里改成和我图里的一样试试,你这个格式可能有问题

sysongyi commented 1 year ago
image
sysongyi commented 1 year ago

我按照你的方式设置了,但还是不成功。

zzzgydi commented 1 year ago

难搞,手动在mac系统设置里设置对应的代理吧。

sysongyi commented 1 year ago

现在我使用快捷指令,临时解决,不知道可否在程序里面集成这种方式: networksetup -setwebproxy "Wi-Fi" 127.0.0.1 7890 networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 7890 networksetup -setsocksfirewallproxy "Wi-Fi" 127.0.0.1 7890 networksetup -setproxybypassdomains "Wi-Fi" 127.0.0.1 192.168.0.0/16 10.0.0.0/8 172.16.0.0/12

Corpama commented 11 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences

sysongyi commented 11 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences

不知道你说的跟我的问题是否是一个问题。我是直到1.3.6版本都无法在macos网络设置下面成自动设置代理。只能手动设置代理使用。最后我找到了通过networksetup 配合快捷指令来设置代理(临时解决方案)

sysongyi commented 11 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences 我这个选项一直以来就是没有选上的。

image
zzzgydi commented 11 months ago

现在我使用快捷指令,临时解决,不知道可否在程序里面集成这种方式: networksetup -setwebproxy "Wi-Fi" 127.0.0.1 7890 networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 7890 networksetup -setsocksfirewallproxy "Wi-Fi" 127.0.0.1 7890 networksetup -setproxybypassdomains "Wi-Fi" 127.0.0.1 192.168.0.0/16 10.0.0.0/8 172.16.0.0/12

程序内部就是用这个命令来设置的,如果设置失败的话,可能是一些未知的bug了,得来点有效的日志看看才能知道了

Corpama commented 11 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences

不知道你说的跟我的问题是否是一个问题。我是直到1.3.6版本都无法在macos网络设置下面成自动设置代理。只能手动设置代理使用。最后我找到了通过networksetup 配合快捷指令来设置代理(临时解决方案)

可以通过terminal来运行clash verge看看在开关system proxy的时候有什么报错,我的是有:Error: Command requires admin privileges

sysongyi commented 11 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences

不知道你说的跟我的问题是否是一个问题。我是直到1.3.6版本都无法在macos网络设置下面成自动设置代理。只能手动设置代理使用。最后我找到了通过networksetup 配合快捷指令来设置代理(临时解决方案)

可以通过terminal来运行clash verge看看在开关system proxy的时候有什么报错,我的是有:Error: Command requires admin privileges

请问如果通过terminal来运行clash verge?

MacBook-Pro ~ % /Applications/Clash\ Verge.app zsh: permission denied: /Applications/Clash Verge.app 提示如上错误信息

Corpama commented 11 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences

不知道你说的跟我的问题是否是一个问题。我是直到1.3.6版本都无法在macos网络设置下面成自动设置代理。只能手动设置代理使用。最后我找到了通过networksetup 配合快捷指令来设置代理(临时解决方案)

可以通过terminal来运行clash verge看看在开关system proxy的时候有什么报错,我的是有:Error: Command requires admin privileges

请问如果通过terminal来运行clash verge?

MacBook-Pro ~ % /Applications/Clash\ Verge.app zsh: permission denied: /Applications/Clash Verge.app 提示如上错误信息

试试这个:./Applications/Clash\ Verge.app/Contents/MacOS/Clash\ Verge

sysongyi commented 11 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences

不知道你说的跟我的问题是否是一个问题。我是直到1.3.6版本都无法在macos网络设置下面成自动设置代理。只能手动设置代理使用。最后我找到了通过networksetup 配合快捷指令来设置代理(临时解决方案)

可以通过terminal来运行clash verge看看在开关system proxy的时候有什么报错,我的是有:Error: Command requires admin privileges

请问如果通过terminal来运行clash verge? MacBook-Pro ~ % /Applications/Clash\ Verge.app zsh: permission denied: /Applications/Clash Verge.app 提示如上错误信息

试试这个:./Applications/Clash\ Verge.app/Contents/MacOS/Clash\ Verge

MacBook-Pro MacOS % ./clash 12:49:21 INF [Inbound] Mixed(http+socks) listening addr=127.0.0.1:7890 12:49:41 INF [TCP] connected, doesn't match any rule lAddr=127.0.0.1:50683 rAddr=github.com:443 proxy=DIRECT 12:49:47 INF [TCP] connected, doesn't match any rule lAddr=127.0.0.1:50686 rAddr=hd.mmstat.com:443 proxy=DIRECT 如何在命令行下启动系统代理呢?

sysongyi commented 11 months ago

我通过GUI方式启动,查看日志:

image
Corpama commented 11 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences

不知道你说的跟我的问题是否是一个问题。我是直到1.3.6版本都无法在macos网络设置下面成自动设置代理。只能手动设置代理使用。最后我找到了通过networksetup 配合快捷指令来设置代理(临时解决方案)

可以通过terminal来运行clash verge看看在开关system proxy的时候有什么报错,我的是有:Error: Command requires admin privileges

请问如果通过terminal来运行clash verge? MacBook-Pro ~ % /Applications/Clash\ Verge.app zsh: permission denied: /Applications/Clash Verge.app 提示如上错误信息

试试这个:./Applications/Clash\ Verge.app/Contents/MacOS/Clash\ Verge

MacBook-Pro MacOS % ./clash 12:49:21 INF [Inbound] Mixed(http+socks) listening addr=127.0.0.1:7890 12:49:41 INF [TCP] connected, doesn't match any rule lAddr=127.0.0.1:50683 rAddr=github.com:443 proxy=DIRECT 12:49:47 INF [TCP] connected, doesn't match any rule lAddr=127.0.0.1:50686 rAddr=hd.mmstat.com:443 proxy=DIRECT 如何在命令行下启动系统代理呢?

直接去设置中开关一下系统代理的开关,然后可以观察terminal中是否有报错信息,不用看软件内的日志的

image
sysongyi commented 11 months ago

通过CLI启动软件,无法在系统里看到GUI管理器。 通过CLI启动软件,手动启动GUI,系统代理开关。在CLI下无任何反馈。

image
sysongyi commented 11 months ago

个人觉得CLI和CUI下是不同的两个工作区域,不能互相影响。 个人感觉是软件获取我本地网卡的名字不对,无发通过后台自动完成networksetup

cnliucheng commented 10 months ago

根据这篇文章的解答,实测可以解决,仅供参考:https://keith.github.io/xcode-man-pages/networksetup.8.html#:~:text=The%20networksetup%20command%20requires%20at,required%20to%20change%20network%20settings. 把这里设置取消勾选一下就行了:System Preferences > Security & Privacy>Advanced>Require an administrator password to access system-wide preferences

的确解决自动设置代理的问题了,我的是M1 Pro芯片,Macos14.0系统