|
@@ -73,3 +73,27 @@ function upload_file() {
|
|
|
function upload_tmp_file() {
|
|
|
upload_file_common "$1" "https://web_history.tianyunperfect.cn/oss/upload_tmp_file"
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+# 获取本机IP地址
|
|
|
+get_ip_address() {
|
|
|
+ ip_address=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | head -n 1)
|
|
|
+ echo "$ip_address"
|
|
|
+}
|
|
|
+
|
|
|
+# 设置代理
|
|
|
+set_proxy() {
|
|
|
+ local ip=$(get_ip_address)
|
|
|
+ local proxy_command="export https_proxy=http://${ip}:7890 http_proxy=http://${ip}:7890 all_proxy=socks5://${ip}:7890"
|
|
|
+ echo "$proxy_command"
|
|
|
+ eval "$proxy_command"
|
|
|
+ echo "Proxy has been set to $ip:7890"
|
|
|
+}
|
|
|
+
|
|
|
+# 取消代理设置
|
|
|
+unset_proxy() {
|
|
|
+ local unset_command="unset https_proxy http_proxy all_proxy"
|
|
|
+ echo "$unset_command"
|
|
|
+ eval "$unset_command"
|
|
|
+ echo "Proxy has been unset"
|
|
|
+}
|