Skip to content

Instantly share code, notes, and snippets.

@yava555
Last active June 8, 2023 07:49
Show Gist options
  • Save yava555/9bbb9f9afb892bed5f263a7f86d5275f to your computer and use it in GitHub Desktop.
Save yava555/9bbb9f9afb892bed5f263a7f86d5275f to your computer and use it in GitHub Desktop.
one click setup android http proxy 一键设置 Android Http 代理
// 关闭代理:adb shell settings put global http_proxy :0
// 开启代理:adb shell settings put global http_proxy 192.168.1.50:8080
// 封装函数,自动获取电脑ip,一键设置代理。adbproxy 8080/off
adbproxy(){
if [[ -z $1 ]];
then adb shell settings put global http_proxy "$(ifconfig | grep 192 | awk '{ print $2 ;}'):8080"
return
fi
if [ "$1" = "off" ] || [ "$1" = "no" ]
then
adb shell settings put global http_proxy :0
else
adb shell settings put global http_proxy "$(ifconfig | grep 192 | awk '{ print $2 ;}'):$1"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment