diff options
Diffstat (limited to 'proxy.sh')
-rw-r--r-- | proxy.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/proxy.sh b/proxy.sh new file mode 100644 index 0000000..2469fc0 --- /dev/null +++ b/proxy.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env dash +# update sub and change proxy +# author: touka@nopwd.lol + +# ============================ +# FIRST READ THE SCRIPT!! +echo "FIRST READ THE SCRIPT!!" +exit +# ============================ + +set -e + +# -- change it to your needs -- +V2RAY_CONFIG=$HOME/.config/v2ray +V2RAY_SUB="https://your-v2ray-sub-link" +OFFSET=3 # line number of first vless link in the decoded links. +# ----------------------------- + +if [ "$#" -eq 0 ]; then +printf "Usage: + $0 [OPTION?] +Options: + n Update subscription + c [number] Change link(to number default first) +" +exit +fi + +cd $V2RAY_CONFIG + +case "$1" in + n) + curl -s -L -o proxies-encode.txt $V2RAY_SUB + base64 -d proxies-encode.txt > proxies.txt + echo "$0: updated subscription" + ;; + c) + linkn=0 + if [ ! -z $2 ]; then + linkn=$2 + fi + awk 'NR==$linkn+$OFFSET' proxies.txt > proxy$linkn.txt + echo "$0: selected proxy $linkn" + vless2json.sh proxy$linkn.txt > config.json + echo "$0: created config.json" + ;; + *) + echo "$0: wrong option" + ;; +esac + |