启动 HTTP(S) 代理:
sudo networksetup -setwebproxy <networkservice> <domain> <port number> <authenticated> <username> <password> && networksetup -setsecurewebproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
关闭 HTTP(S) 代理
sudo -S networksetup -setwebproxystate <networkservice> <on off> && networksetup -setsecurewebproxystate <networkservice> <on off>
启动:
networkservice="Wi-Fi"
proxy_domain=192.168.001.005
proxy_port=7890
sudo networksetup -setwebproxy $networkservice $proxy_domain $proxy_port && networksetup -setsecurewebproxy $networkservice $proxy_domain $proxy_port
关闭:
networkservice="Wi-Fi"
sudo -S networksetup -setwebproxystate $networkservice off && sudo networksetup -setsecurewebproxystate $networkservice off