Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

keep proxy

乐平 edited this page Oct 10, 2022 · 4 revisions
#!/bin/bash
trap resetProxy 0
tput clear
stty -echo

resetProxy() {
  networksetup -setsecurewebproxystate "Wi-Fi" off
  networksetup -setwebproxystate "Wi-Fi" off
  networksetup -setautoproxystate "Wi-Fi" off

  tput clear
  echo 代理已关闭🚫
  exit 0
}

processing_i=0
processing_char=('🌍' '🌏' '🌎')

while ((1)); do
  sleep 2
  networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 12889
  networksetup -setwebproxy "Wi-Fi" 127.0.0.1 12889
  networksetup -setautoproxyurl "Wi-Fi" http://127.0.0.1:53352

  printf "保持代理中%s\r" ${processing_char[$processing_i]}
  processing_i=$(((processing_i + 1) % ${#processing_char[@]}))
done
Clone this wiki locally