Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
shell:快速更换代理
Apps Section
4064
views ·
0
replies ·
To
floor
Go
海天鹰
deepin
2018-12-28 19:50
Author
本帖最后由 sonichy 于 2018-12-28 11:55 编辑
控制中心设置代理太不方便了。
shell做个菜单,利用 deepin 的 dbus 实现快速切换代理。浏览器需要设置为系统代理,火狐好办,谷歌需要扩展实现。
需要其他代理的,按照结构,自己改,自己加。
缺点:输出信息太多,怎么去除?
displayProxy(){
echo "当前代理:"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.GetProxyMethod
echo "http:"
dbus-send --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.GetProxy string:'http'
echo "https:"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.GetProxy string:'https'
}
displayProxy
echo
echo "代理设置:"
echo "1 127.0.0.1:8087"
echo "2 127.0.0.1:19180"
echo "3 127.0.0.1:37799"
echo "8 取消代理"
echo "9 显示当前代理"
echo "0 退出"
while true
do
echo
echo "请选择:"
read input
case $input in
1)
echo "127.0.0.1:8087"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'http' string:'127.0.0.1' string:'8087'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'https' string:'127.0.0.1' string:'8087'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxyMethod string:'manual'
displayProxy
;;
2)
echo "127.0.0.1:19180"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'http' string:'127.0.0.1' string:'19180'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'https' string:'127.0.0.1' string:'19180'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxyMethod string:'manual'
displayProxy
;;
3)
echo "127.0.0.1:37799"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'http' string:'127.0.0.1' string:'37799'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'https' string:'127.0.0.1' string:'37799'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxyMethod string:'manual'
displayProxy
;;
8)
echo "取消代理"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxyMethod string:'none'
;;
9)
displayProxy
;;
0)
echo "退出"
exit
;;
*)
echo "输入错误!"
;;
esac
done
Reply
Like 0
Favorite
View the author
All Replies
No replies yet
Please
sign
in first
New Thread
Popular Ranking
Change
My beautiful Deepin-colored stock chart theme
Latest wine version
deepin 23 internal testing update on November 15, 2024
Update Announcement for deepin 23 Official Version on 11.14, 2024
presentation mode
System analyst
Popular Events
More
控制中心设置代理太不方便了。
shell做个菜单,利用 deepin 的 dbus 实现快速切换代理。浏览器需要设置为系统代理,火狐好办,谷歌需要扩展实现。
需要其他代理的,按照结构,自己改,自己加。
缺点:输出信息太多,怎么去除?
displayProxy(){
echo "当前代理:"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.GetProxyMethod
echo "http:"
dbus-send --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.GetProxy string:'http'
echo "https:"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.GetProxy string:'https'
}
displayProxy
echo
echo "代理设置:"
echo "1 127.0.0.1:8087"
echo "2 127.0.0.1:19180"
echo "3 127.0.0.1:37799"
echo "8 取消代理"
echo "9 显示当前代理"
echo "0 退出"
while true
do
echo
echo "请选择:"
read input
case $input in
1)
echo "127.0.0.1:8087"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'http' string:'127.0.0.1' string:'8087'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'https' string:'127.0.0.1' string:'8087'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxyMethod string:'manual'
displayProxy
;;
2)
echo "127.0.0.1:19180"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'http' string:'127.0.0.1' string:'19180'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'https' string:'127.0.0.1' string:'19180'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxyMethod string:'manual'
displayProxy
;;
3)
echo "127.0.0.1:37799"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'http' string:'127.0.0.1' string:'37799'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxy string:'https' string:'127.0.0.1' string:'37799'
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxyMethod string:'manual'
displayProxy
;;
8)
echo "取消代理"
dbus-send --session --print-reply --dest=com.deepin.daemon.Network /com/deepin/daemon/Network com.deepin.daemon.Network.SetProxyMethod string:'none'
;;
9)
displayProxy
;;
0)
echo "退出"
exit
;;
*)
echo "输入错误!"
;;
esac
done