summaryrefslogtreecommitdiff
path: root/proxy.sh
diff options
context:
space:
mode:
authortouka <touka@nopwd.lol>2024-07-05 12:37:29 +0000
committertouka <touka@nopwd.lol>2024-07-05 12:37:29 +0000
commite6a378e3d441d9ffcd57428c4456313116d9d89c (patch)
treec6eadfb7eb52198b4e4ede99c7baa8d72dd7e3df /proxy.sh
Basic toolsHEADmain
Diffstat (limited to 'proxy.sh')
-rw-r--r--proxy.sh51
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
+