forked from frainzy1477/luci-app-clash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
frainzy1477
committed
Feb 7, 2020
1 parent
29f6977
commit fa7e7a2
Showing
16 changed files
with
120 additions
and
36 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
CURL_GROUP_CACHE="/usr/share/clashbackup/clash_gorup.json" | ||
CURL_NOW_CACHE="/usr/share/clashbackup/clash_now.json" | ||
CURL_CACHE="/usr/share/clashbackup/clash_curl.json" | ||
HISTORY_PATH="/usr/share/clashbackup/history" | ||
SECRET=$(uci get clash.config.dash_pass 2>/dev/null) | ||
LAN_IP=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null) | ||
PORT=$(uci get clash.config.dash_port 2>/dev/null) | ||
|
||
curl -w %{http_code}"\n" -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X GET http://"$LAN_IP":"$PORT"/proxies > "$CURL_CACHE" 2>/dev/null | ||
if [ "$(sed -n '$p' "$CURL_CACHE")" -eq "200" ]; then | ||
cat "$CURL_CACHE" |jsonfilter -e '@["proxies"][@.type="Selector"]["name"]' > "$CURL_GROUP_CACHE" 2>/dev/null | ||
cat "$CURL_CACHE" |jsonfilter -e '@["proxies"][@.type="Selector"]["now"]' > "$CURL_NOW_CACHE" 2>/dev/null | ||
awk 'NR==FNR{a[i]=$0;i++}NR>FNR{print a[j]"#*#"$0;j++}' "$CURL_GROUP_CACHE" "$CURL_NOW_CACHE" > "$HISTORY_PATH" 2>/dev/null | ||
fi | ||
rm -rf /usr/share/clashbackup/clash_*.json 2>/dev/null |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
|
||
experimental: | ||
ignore-resolve-fail: true | ||
|
||
#authentication: | ||
# - "user1:pass1" | ||
# hosts: | ||
# '*.clash.dev': 127.0.0.1 | ||
# 'alpha.clash.dev': '::1' | ||
|
||
#hosts: | ||
# '*.clash.dev': 127.0.0.1 | ||
# 'alpha.clash.dev': '::1' | ||
|
||
dns: | ||
enable: true | ||
listen: 0.0.0.0:5300 | ||
enhanced-mode: fake-ip | ||
fake-ip-range: 198.18.0.1/16 | ||
#fake-ip-filter: | ||
# - '*.lan' | ||
# - localhost.ptlogin2.qq.com | ||
#fake-ip-filter: | ||
# - '*.lan' | ||
# - localhost.ptlogin2.qq.com | ||
nameserver: | ||
- 114.114.114.114 | ||
- udp://114.114.114.114 | ||
- tls://118.89.110.78:853 | ||
- tls://47.96.179.163:853 | ||
- udp://8.8.8.8:53 | ||
- udp://8.8.4.4:53 | ||
- tcp://1.1.1.1 | ||
fallback: | ||
fallback: | ||
- tls://118.89.110.78:853 | ||
- tls://47.96.179.163:853 | ||
- tcp://1.1.1.1 | ||
- tcp://8.8.8.8 | ||
fallback-filter: | ||
fallback-filter: | ||
geoip: true | ||
ipcidr: | ||
- 240.0.0.0/4 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.5.2 | ||
1.5.3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -636,3 +636,4 @@ fi | |
fi | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
if [ -f /usr/share/clashbackup/history ];then | ||
HISTORY_PATH="/usr/share/clashbackup/history" | ||
SECRET=$(uci get clash.config.dash_pass 2>/dev/null) | ||
LAN_IP=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null) | ||
PORT=$(uci get clash.config.dash_port 2>/dev/null) | ||
|
||
if [ ! -z "$(grep "#*#" "$HISTORY_PATH")" ]; then | ||
cat $HISTORY_PATH |while read line | ||
do | ||
GORUP_NAME=$(echo $line |awk -F '#*#' '{print $1}') | ||
NOW_NAME=$(echo $line |awk -F '#*#' '{print $3}') | ||
curl -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X PUT -d '{"name":"'"$NOW_NAME"'"}' http://"$LAN_IP":"$PORT"/proxies/"$GORUP_NAME" >/dev/null 2>&1 | ||
done | ||
fi | ||
fi | ||
|
||
|
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
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