Last active
June 8, 2023 07:49
-
-
Save yava555/9bbb9f9afb892bed5f263a7f86d5275f to your computer and use it in GitHub Desktop.
one click setup android http proxy 一键设置 Android Http 代理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 关闭代理: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