-
Notifications
You must be signed in to change notification settings - Fork 1
/
ox-utils-network.sh
38 lines (33 loc) · 832 Bytes
/
ox-utils-network.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash /bin/zsh
##########################################################
# Proxy Utils
##########################################################
# px=proxy
px() {
if [[ ${#1} -lt 3 ]]; then
local port=${OX_PROXY[$1]}
else
local port=$1
fi
echo "using port $port"
export https_proxy=http://127.0.0.1:$port
export http_proxy=http://127.0.0.1:$port
export all_proxy=socks5://127.0.0.1:$port
}
pxq() {
echo 'unset all proxies'
unset https_proxy
unset http_proxy
unset all_proxy
}
##########################################################
# wsl
##########################################################
# host list
host_ls() {
rg "nameserver" </etc/resolv.conf | cut -f 2 -d " "
}
# host proxy
host_px() {
export ALL_PROXY="https://$1:${OX_PROXY[$2]}"
}