mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 19:46:52 +03:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16c174d624 | ||
|
|
1c02a2208b | ||
|
|
2c93e98755 | ||
|
|
66b179f282 | ||
|
|
4bbaae776c | ||
|
|
e31f313819 | ||
|
|
bd0e33781f | ||
|
|
ade2b844ec | ||
|
|
6f997a6e73 | ||
|
|
744de6aec2 | ||
|
|
ae06de8189 | ||
|
|
1663f6665f | ||
|
|
b005cbe50e | ||
|
|
6c752d59ce | ||
|
|
dbdd0560bf | ||
|
|
aeacd9d8fd | ||
|
|
ded0bff23a | ||
|
|
80ab7caee9 | ||
|
|
516063310a | ||
|
|
c6d72aa781 | ||
|
|
91fa2a2859 | ||
|
|
13e84afcf0 | ||
|
|
88c160d3f8 | ||
|
|
ebd185f633 | ||
|
|
e86bffb720 | ||
|
|
fb65b63639 | ||
|
|
daf7e30ed1 | ||
|
|
dd62ecfbeb | ||
|
|
41cb8cd650 | ||
|
|
b7ad256986 | ||
|
|
f88ffa1893 |
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* @itdoginfo
|
||||||
17
README.md
17
README.md
@@ -20,7 +20,8 @@ sh <(wget -O - https://raw.githubusercontent.com/itdoginfo/domain-routing-openwr
|
|||||||
|
|
||||||
# Установка Podkop
|
# Установка Podkop
|
||||||
Пакет работает на всех архитектурах.
|
Пакет работает на всех архитектурах.
|
||||||
Тестировался на OpenWrt 23.05 и OpenWrt 24.10.
|
Тестировался на **ванильной** OpenWrt 23.05 и OpenWrt 24.10.
|
||||||
|
На FriendlyWrt 23.05 присуствуют зависимости от iptables, которые ломают tproxy. Если у вас появляется warning про это в логах, следуйте инструкции по приведённой там ссылке.
|
||||||
|
|
||||||
Поддержки APK на данный момент нет. APK будет сделан после того как разгребу основное.
|
Поддержки APK на данный момент нет. APK будет сделан после того как разгребу основное.
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ sh <(wget -O - https://raw.githubusercontent.com/itdoginfo/podkop/refs/heads/mai
|
|||||||
|
|
||||||
# Удаление
|
# Удаление
|
||||||
```
|
```
|
||||||
opkg remove luci-app-podkop podkop
|
opkg remove luci-i18n-podkop-ru luci-app-podkop podkop
|
||||||
```
|
```
|
||||||
|
|
||||||
Если был установлен русский язык
|
Если был установлен русский язык
|
||||||
@@ -100,6 +101,8 @@ Luci: Services/podkop
|
|||||||
list doh_server '127.0.0.1#5053'
|
list doh_server '127.0.0.1#5053'
|
||||||
list doh_server '127.0.0.1#5054'
|
list doh_server '127.0.0.1#5054'
|
||||||
```
|
```
|
||||||
|
- [x] Только кастомный remote list не создаёт секцию в route-rules-rule-set и dns-rules-ruleset
|
||||||
|
|
||||||
# ToDo
|
# ToDo
|
||||||
Этот раздел не означает задачи, которые нужно брать и делать. Это общий список хотелок. Если вы хотите помочь, пожалуйста, спросите сначала в телеграмме.
|
Этот раздел не означает задачи, которые нужно брать и делать. Это общий список хотелок. Если вы хотите помочь, пожалуйста, спросите сначала в телеграмме.
|
||||||
|
|
||||||
@@ -151,6 +154,8 @@ Luci: Services/podkop
|
|||||||
- [ ] Сделать галку запрещающую подкопу редачить dhcp. Допилить в исключение вместе с пустыми полями proxy и vpn
|
- [ ] Сделать галку запрещающую подкопу редачить dhcp. Допилить в исключение вместе с пустыми полями proxy и vpn
|
||||||
- [ ] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
|
- [ ] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
|
||||||
- [ ] Добавление в список доменов домены первого уровня (LuCI)
|
- [ ] Добавление в список доменов домены первого уровня (LuCI)
|
||||||
|
- [ ] Проверка, что версия в makefile совпадает с тегом
|
||||||
|
- [ ] Don't touch my DHCP!
|
||||||
|
|
||||||
Приоритет 2
|
Приоритет 2
|
||||||
- [x] Списки доменов и подсетей с роутера
|
- [x] Списки доменов и подсетей с роутера
|
||||||
@@ -177,6 +182,14 @@ Wiki
|
|||||||
Хз как сделать
|
Хз как сделать
|
||||||
- [ ] Добавить label от конфига vless\ss\etc в luci.
|
- [ ] Добавить label от конфига vless\ss\etc в luci.
|
||||||
|
|
||||||
|
# Установка версии v0.2.5
|
||||||
|
Удаляет полностью все пакеты podkop. Удаляет текущую конфигурацию podkop.
|
||||||
|
После установки **обязательно** сбросьте кэш в LuCI.
|
||||||
|
|
||||||
|
```
|
||||||
|
sh <(wget -O - https://raw.githubusercontent.com/itdoginfo/podkop/refs/heads/main/install-v0.2.5.sh)
|
||||||
|
```
|
||||||
|
|
||||||
# Разработка
|
# Разработка
|
||||||
Есть два варианта:
|
Есть два варианта:
|
||||||
- Просто поставить пакет на роутер или виртуалку и прям редактировать через SFTP (opkg install openssh-sftp-server)
|
- Просто поставить пакет на роутер или виртуалку и прям редактировать через SFTP (opkg install openssh-sftp-server)
|
||||||
|
|||||||
97
install-v0.2.5.sh
Executable file
97
install-v0.2.5.sh
Executable file
@@ -0,0 +1,97 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
REPO="https://api.github.com/repos/itdoginfo/podkop/releases/tags/v0.2.5"
|
||||||
|
|
||||||
|
DOWNLOAD_DIR="/tmp/podkop"
|
||||||
|
COUNT=3
|
||||||
|
|
||||||
|
rm -rf "$DOWNLOAD_DIR"
|
||||||
|
mkdir -p "$DOWNLOAD_DIR"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_system
|
||||||
|
|
||||||
|
opkg update
|
||||||
|
|
||||||
|
if [ -f "/etc/init.d/podkop" ]; then
|
||||||
|
echo "Remove current vesrion podkop"
|
||||||
|
opkg remove luci-i18n-podkop-ru luci-app-podkop podkop
|
||||||
|
rm /etc/config/podkop
|
||||||
|
else
|
||||||
|
echo "Installed podkop..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk' | while read -r url; do
|
||||||
|
filename=$(basename "$url")
|
||||||
|
filepath="$DOWNLOAD_DIR/$filename"
|
||||||
|
|
||||||
|
attempt=0
|
||||||
|
while [ $attempt -lt $COUNT ]; do
|
||||||
|
if [ -f "$filepath" ] && [ -s "$filepath" ]; then
|
||||||
|
echo "$filename has already been uploaded"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Download $filename (count $((attempt+1)))..."
|
||||||
|
wget -q -O "$filepath" "$url"
|
||||||
|
|
||||||
|
if [ -s "$filepath" ]; then
|
||||||
|
echo "$filename successfully downloaded"
|
||||||
|
else
|
||||||
|
echo "Download error $filename. Retry..."
|
||||||
|
rm -f "$filepath"
|
||||||
|
fi
|
||||||
|
attempt=$((attempt+1))
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
for pkg in podkop luci-app-podkop; do
|
||||||
|
file=$(ls "$DOWNLOAD_DIR" | grep "^$pkg" | head -n 1)
|
||||||
|
if [ -n "$file" ]; then
|
||||||
|
echo "Installing $file"
|
||||||
|
opkg install "$DOWNLOAD_DIR/$file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
ru=$(ls "$DOWNLOAD_DIR" | grep "luci-i18n-podkop-ru" | head -n 1)
|
||||||
|
if [ -n "$ru" ]; then
|
||||||
|
printf "\033[32;1mРусский язык интерфейса ставим? y/n (Need a Russian translation?)\033[0m "
|
||||||
|
while true; do
|
||||||
|
read -r -p '' RUS
|
||||||
|
case $RUS in
|
||||||
|
y)
|
||||||
|
opkg install "$DOWNLOAD_DIR/$ru"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
n)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Введите y или n"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk $DOWNLOAD_DIR/luci-i18n-podkop-ru*.ipk
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
check_system() {
|
||||||
|
# Get router model
|
||||||
|
MODEL=$(cat /tmp/sysinfo/model)
|
||||||
|
echo "Router model: $MODEL"
|
||||||
|
|
||||||
|
if ! nslookup google.com >/dev/null 2>&1; then
|
||||||
|
log "DNS not working"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if opkg list-installed | grep -qE "iptables|kmod-iptab"; then
|
||||||
|
printf "\033[31;1mFound incompatible iptables packages. If you're using FriendlyWrt: https://t.me/itdogchat/44512/181082\033[0m\n"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
104
install.sh
104
install.sh
@@ -13,38 +13,12 @@ main() {
|
|||||||
check_system
|
check_system
|
||||||
sing_box
|
sing_box
|
||||||
|
|
||||||
wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk' | while read -r url; do
|
|
||||||
filename=$(basename "$url")
|
|
||||||
filepath="$DOWNLOAD_DIR/$filename"
|
|
||||||
|
|
||||||
attempt=0
|
|
||||||
while [ $attempt -lt $COUNT ]; do
|
|
||||||
if [ -f "$filepath" ] && [ -s "$filepath" ]; then
|
|
||||||
echo "$filename has already been uploaded"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Download $filename (count $((attempt+1)))..."
|
|
||||||
wget -q -O "$filepath" "$url"
|
|
||||||
|
|
||||||
if [ -s "$filepath" ]; then
|
|
||||||
echo "$filename successfully downloaded"
|
|
||||||
break
|
|
||||||
else
|
|
||||||
echo "Download error $filename. Retry..."
|
|
||||||
rm -f "$filepath"
|
|
||||||
fi
|
|
||||||
attempt=$((attempt+1))
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "opkg update"
|
|
||||||
opkg update
|
opkg update
|
||||||
|
|
||||||
if [ -f "/etc/init.d/podkop" ]; then
|
if [ -f "/etc/init.d/podkop" ]; then
|
||||||
printf "\033[32;1mPodkop is already installed. Just upgrade it? (y/n)\033[0m\n"
|
printf "\033[32;1mPodkop is already installed. Just upgrade it? (y/n)\033[0m\n"
|
||||||
printf "\033[32;1my - Only upgrade podkop\033[0m\n"
|
printf "\033[32;1my - Only upgrade podkop\033[0m\n"
|
||||||
printf "\033[32;1mn - Upgrade and install proxy or tunnels\033[0m\n"
|
printf "\033[32;1mn - Upgrade and install tunnels (WG, AWG, OpenVPN, OC)\033[0m\n"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -r -p '' UPDATE
|
read -r -p '' UPDATE
|
||||||
@@ -69,30 +43,66 @@ main() {
|
|||||||
add_tunnel
|
add_tunnel
|
||||||
fi
|
fi
|
||||||
|
|
||||||
opkg install $DOWNLOAD_DIR/podkop*.ipk
|
download_success=0
|
||||||
opkg install $DOWNLOAD_DIR/luci-app-podkop*.ipk
|
while read -r url; do
|
||||||
|
filename=$(basename "$url")
|
||||||
|
filepath="$DOWNLOAD_DIR/$filename"
|
||||||
|
|
||||||
|
attempt=0
|
||||||
|
while [ $attempt -lt $COUNT ]; do
|
||||||
|
echo "Download $filename (count $((attempt+1)))..."
|
||||||
|
if wget -q -O "$filepath" "$url"; then
|
||||||
|
if [ -s "$filepath" ]; then
|
||||||
|
echo "$filename successfully downloaded"
|
||||||
|
download_success=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "Download error $filename. Retry..."
|
||||||
|
rm -f "$filepath"
|
||||||
|
attempt=$((attempt+1))
|
||||||
|
done
|
||||||
|
|
||||||
echo "Русский язык интерфейса ставим? y/n (Need a Russian translation?)"
|
if [ $attempt -eq $COUNT ]; then
|
||||||
|
echo "Failed to download $filename after $COUNT attempts"
|
||||||
|
fi
|
||||||
|
done < <(wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk')
|
||||||
|
|
||||||
|
if [ $download_success -eq 0 ]; then
|
||||||
|
echo "No packages were downloaded successfully"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for pkg in podkop luci-app-podkop; do
|
||||||
|
file=$(ls "$DOWNLOAD_DIR" | grep "^$pkg" | head -n 1)
|
||||||
|
if [ -n "$file" ]; then
|
||||||
|
echo "Installing $file"
|
||||||
|
opkg install "$DOWNLOAD_DIR/$file"
|
||||||
|
sleep 3
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
ru=$(ls "$DOWNLOAD_DIR" | grep "luci-i18n-podkop-ru" | head -n 1)
|
||||||
|
if [ -n "$ru" ]; then
|
||||||
|
printf "\033[32;1mРусский язык интерфейса ставим? y/n (Need a Russian translation?)\033[0m "
|
||||||
while true; do
|
while true; do
|
||||||
read -r -p '' RUS
|
read -r -p '' RUS
|
||||||
case $RUS in
|
case $RUS in
|
||||||
y)
|
y)
|
||||||
opkg install $DOWNLOAD_DIR/luci-i18n-podkop-ru*.ipk
|
opkg install "$DOWNLOAD_DIR/$ru"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
|
||||||
n)
|
n)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Please enter y or n"
|
echo "Введите y или n"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk $DOWNLOAD_DIR/luci-i18n-podkop-ru*.ipk
|
find "$DOWNLOAD_DIR" -type f -name '*podkop*' -exec rm {} \;
|
||||||
|
|
||||||
if [ "$IS_SHOULD_RESTART_NETWORK" ]; then
|
if [ "$IS_SHOULD_RESTART_NETWORK" ]; then
|
||||||
printf "\033[32;1mRestart network\033[0m\n"
|
printf "\033[32;1mRestart network\033[0m\n"
|
||||||
@@ -101,7 +111,7 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_tunnel() {
|
add_tunnel() {
|
||||||
echo "Will you be using Wireguard, AmneziaWG, OpenVPN, OpenConnect? If yes, select a number and they will be automatically installed"
|
printf "\033[32;1mWill you be using Wireguard, AmneziaWG, OpenVPN, OpenConnect? If yes, select a number and they will be automatically installed\033[0m "
|
||||||
echo "1) Wireguard"
|
echo "1) Wireguard"
|
||||||
echo "2) AmneziaWG"
|
echo "2) AmneziaWG"
|
||||||
echo "3) OpenVPN"
|
echo "3) OpenVPN"
|
||||||
@@ -153,7 +163,7 @@ add_tunnel() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
5)
|
5)
|
||||||
echo "Skip. Use this if you're installing an upgrade."
|
echo "Installation without additional dependencies."
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -391,21 +401,31 @@ check_system() {
|
|||||||
echo "Router model: $MODEL"
|
echo "Router model: $MODEL"
|
||||||
|
|
||||||
# Check available space
|
# Check available space
|
||||||
AVAILABLE_SPACE=$(df /tmp | awk 'NR==2 {print $4}')
|
AVAILABLE_SPACE=$(df /overlay | awk 'NR==2 {print $4}')
|
||||||
REQUIRED_SPACE=15360 # 15MB in KB
|
REQUIRED_SPACE=15360 # 15MB in KB
|
||||||
|
|
||||||
echo "Available space: $((AVAILABLE_SPACE/1024))MB"
|
|
||||||
echo "Required space: $((REQUIRED_SPACE/1024))MB"
|
|
||||||
|
|
||||||
if [ "$AVAILABLE_SPACE" -lt "$REQUIRED_SPACE" ]; then
|
if [ "$AVAILABLE_SPACE" -lt "$REQUIRED_SPACE" ]; then
|
||||||
echo "Error: Insufficient space in /tmp"
|
printf "\033[31;1mError: Insufficient space in flash\033[0m\n"
|
||||||
echo "Available: $((AVAILABLE_SPACE/1024))MB"
|
echo "Available: $((AVAILABLE_SPACE/1024))MB"
|
||||||
echo "Required: $((REQUIRED_SPACE/1024))MB"
|
echo "Required: $((REQUIRED_SPACE/1024))MB"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! nslookup google.com >/dev/null 2>&1; then
|
||||||
|
log "DNS not working"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if opkg list-installed | grep -qE "iptables|kmod-iptab"; then
|
||||||
|
printf "\033[31;1mFound incompatible iptables packages. If you're using FriendlyWrt: https://t.me/itdogchat/44512/181082\033[0m\n"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
sing_box() {
|
sing_box() {
|
||||||
|
if ! opkg list-installed | grep -q "^sing-box"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
sing_box_version=$(sing-box version | head -n 1 | awk '{print $3}')
|
sing_box_version=$(sing-box version | head -n 1 | awk '{print $3}')
|
||||||
required_version="1.11.1"
|
required_version="1.11.1"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-podkop
|
PKG_NAME:=luci-app-podkop
|
||||||
PKG_VERSION:=0.3.7
|
PKG_VERSION:=0.3.10
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI podkop app
|
LUCI_TITLE:=LuCI podkop app
|
||||||
|
|||||||
@@ -112,6 +112,76 @@ return view.extend({
|
|||||||
o.rmempty = false;
|
o.rmempty = false;
|
||||||
o.ucisection = 'main';
|
o.ucisection = 'main';
|
||||||
|
|
||||||
|
let lastValues = [];
|
||||||
|
let isProcessing = false;
|
||||||
|
|
||||||
|
o.onchange = function (ev, section_id, value) {
|
||||||
|
if (isProcessing) return;
|
||||||
|
isProcessing = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const values = Array.isArray(value) ? value : [value];
|
||||||
|
let newValues = [...values];
|
||||||
|
let notifications = [];
|
||||||
|
|
||||||
|
// Проверка взаимоисключающих региональных опций
|
||||||
|
const regionalOptions = ['russia_inside', 'russia_outside', 'ukraine_inside'];
|
||||||
|
const selectedRegionalOptions = regionalOptions.filter(opt => newValues.includes(opt));
|
||||||
|
|
||||||
|
if (selectedRegionalOptions.length > 1) {
|
||||||
|
// Оставляем только последний выбранный региональный вариант
|
||||||
|
const lastSelected = selectedRegionalOptions[selectedRegionalOptions.length - 1];
|
||||||
|
const removedRegions = selectedRegionalOptions.slice(0, -1);
|
||||||
|
newValues = newValues.filter(v => v === lastSelected || !regionalOptions.includes(v));
|
||||||
|
|
||||||
|
const warningMsg = _('Warning: %s cannot be used together with %s. Previous selections have been removed.').format(
|
||||||
|
removedRegions.join(', '),
|
||||||
|
lastSelected
|
||||||
|
);
|
||||||
|
|
||||||
|
notifications.push(E('p', { class: 'alert-message warning' }, [
|
||||||
|
E('strong', {}, _('Regional options cannot be used together')), E('br'),
|
||||||
|
warningMsg
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Специальная обработка для russia_inside
|
||||||
|
if (newValues.includes('russia_inside')) {
|
||||||
|
const allowedWithRussiaInside = ['russia_inside', 'meta', 'twitter', 'discord', 'telegram'];
|
||||||
|
const removedServices = newValues.filter(v => !allowedWithRussiaInside.includes(v));
|
||||||
|
|
||||||
|
if (removedServices.length > 0) {
|
||||||
|
newValues = newValues.filter(v => allowedWithRussiaInside.includes(v));
|
||||||
|
|
||||||
|
const warningMsg = _('Warning: Russia inside can only be used with Meta, Twitter, Discord, and Telegram. %s have been removed from selection.').format(
|
||||||
|
removedServices.join(', ')
|
||||||
|
);
|
||||||
|
|
||||||
|
notifications.push(E('p', { class: 'alert-message warning' }, [
|
||||||
|
E('strong', {}, _('Russia inside restrictions')), E('br'),
|
||||||
|
warningMsg
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Если были изменения, обновляем значения
|
||||||
|
if (JSON.stringify(newValues.sort()) !== JSON.stringify(values.sort())) {
|
||||||
|
this.getUIElement(section_id).setValue(newValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Показываем все накопленные уведомления
|
||||||
|
notifications.forEach(notification => {
|
||||||
|
ui.addNotification(null, notification);
|
||||||
|
});
|
||||||
|
|
||||||
|
lastValues = newValues;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error in onchange handler:', e);
|
||||||
|
} finally {
|
||||||
|
isProcessing = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
o = s.taboption('basic', form.ListValue, 'custom_domains_list_type', _('User Domain List Type'), _('Select how to add your custom domains'));
|
o = s.taboption('basic', form.ListValue, 'custom_domains_list_type', _('User Domain List Type'), _('Select how to add your custom domains'));
|
||||||
o.value('disabled', _('Disabled'));
|
o.value('disabled', _('Disabled'));
|
||||||
o.value('dynamic', _('Dynamic List'));
|
o.value('dynamic', _('Dynamic List'));
|
||||||
@@ -442,18 +512,17 @@ return view.extend({
|
|||||||
`: ${status === 'available' ? '✓' : '✗'}`);
|
`: ${status === 'available' ? '✓' : '✗'}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check All - full diagnostic
|
// Connection Checks Section
|
||||||
o = s.taboption('diagnostics', form.Button, '_check_all');
|
o = s.taboption('diagnostics', form.Button, '_check_nft');
|
||||||
o.title = _('Main Check');
|
o.title = _('NFT Rules');
|
||||||
o.description = _('Run a comprehensive diagnostic check of all components');
|
o.description = _('Show current nftables rules and statistics');
|
||||||
o.inputtitle = _('Run Check');
|
o.inputtitle = _('Check Rules');
|
||||||
o.inputstyle = 'apply';
|
o.inputstyle = 'apply';
|
||||||
o.onclick = function () {
|
o.onclick = function () {
|
||||||
return fs.exec('/etc/init.d/podkop', ['check_three'])
|
return fs.exec('/etc/init.d/podkop', ['check_nft'])
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
||||||
|
ui.showModal(_('NFT Rules'), [
|
||||||
const modalElement = ui.showModal(_('Full Diagnostic Results'), [
|
|
||||||
E('div', {
|
E('div', {
|
||||||
style:
|
style:
|
||||||
'max-height: 70vh;' +
|
'max-height: 70vh;' +
|
||||||
@@ -478,7 +547,7 @@ return view.extend({
|
|||||||
'class': 'btn',
|
'class': 'btn',
|
||||||
'click': function () {
|
'click': function () {
|
||||||
const textarea = document.createElement('textarea');
|
const textarea = document.createElement('textarea');
|
||||||
textarea.value = '```txt\n' + formattedOutput + '\n```';
|
textarea.value = formattedOutput;
|
||||||
document.body.appendChild(textarea);
|
document.body.appendChild(textarea);
|
||||||
textarea.select();
|
textarea.select();
|
||||||
try {
|
try {
|
||||||
@@ -494,27 +563,77 @@ return view.extend({
|
|||||||
'click': ui.hideModal
|
'click': ui.hideModal
|
||||||
}, _('Close'))
|
}, _('Close'))
|
||||||
])
|
])
|
||||||
], 'large');
|
]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
if (modalElement && modalElement.parentElement) {
|
|
||||||
modalElement.parentElement.style.width = '90%';
|
|
||||||
modalElement.parentElement.style.maxWidth = '1200px';
|
// Logs Section
|
||||||
modalElement.parentElement.style.margin = '2rem auto';
|
o = s.taboption('diagnostics', form.Button, '_check_sing_box_logs');
|
||||||
|
o.title = _('Sing-Box Logs');
|
||||||
|
o.description = _('View recent sing-box logs from system journal');
|
||||||
|
o.inputtitle = _('View Sing-Box Logs');
|
||||||
|
o.inputstyle = 'apply';
|
||||||
|
o.onclick = function () {
|
||||||
|
return fs.exec('/etc/init.d/podkop', ['check_sing_box_logs'])
|
||||||
|
.then(function (res) {
|
||||||
|
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
||||||
|
ui.showModal(_('Sing-Box Logs'), [
|
||||||
|
E('div', {
|
||||||
|
style:
|
||||||
|
'max-height: 70vh;' +
|
||||||
|
'overflow-y: auto;' +
|
||||||
|
'margin: 1em 0;' +
|
||||||
|
'padding: 1.5em;' +
|
||||||
|
'background: #f8f9fa;' +
|
||||||
|
'border: 1px solid #e9ecef;' +
|
||||||
|
'border-radius: 4px;' +
|
||||||
|
'font-family: monospace;' +
|
||||||
|
'white-space: pre-wrap;' +
|
||||||
|
'word-wrap: break-word;' +
|
||||||
|
'line-height: 1.5;' +
|
||||||
|
'font-size: 14px;'
|
||||||
|
}, [
|
||||||
|
E('pre', { style: 'margin: 0;' }, formattedOutput)
|
||||||
|
]),
|
||||||
|
E('div', {
|
||||||
|
style: 'display: flex; justify-content: space-between; margin-top: 1em;'
|
||||||
|
}, [
|
||||||
|
E('button', {
|
||||||
|
'class': 'btn',
|
||||||
|
'click': function () {
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.value = formattedOutput;
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
try {
|
||||||
|
document.execCommand('copy');
|
||||||
|
} catch (err) {
|
||||||
|
ui.addNotification(null, E('p', {}, _('Failed to copy: ') + err.message));
|
||||||
}
|
}
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
}
|
||||||
|
}, _('Copy to Clipboard')),
|
||||||
|
E('button', {
|
||||||
|
'class': 'btn',
|
||||||
|
'click': ui.hideModal
|
||||||
|
}, _('Close'))
|
||||||
|
])
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
o = s.taboption('diagnostics', form.Button, '_check_logs');
|
o = s.taboption('diagnostics', form.Button, '_check_logs');
|
||||||
o.title = _('System Logs');
|
o.title = _('Podkop Logs');
|
||||||
o.description = _('View recent system logs related to Podkop');
|
o.description = _('View recent podkop logs from system journal');
|
||||||
o.inputtitle = _('View Logs');
|
o.inputtitle = _('View Podkop Logs');
|
||||||
o.inputstyle = 'apply';
|
o.inputstyle = 'apply';
|
||||||
o.onclick = function () {
|
o.onclick = function () {
|
||||||
return fs.exec('/etc/init.d/podkop', ['check_logs'])
|
return fs.exec('/etc/init.d/podkop', ['check_logs'])
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
||||||
|
ui.showModal(_('Podkop Logs'), [
|
||||||
const modalElement = ui.showModal(_('System Logs'), [
|
|
||||||
E('div', {
|
E('div', {
|
||||||
style:
|
style:
|
||||||
'max-height: 70vh;' +
|
'max-height: 70vh;' +
|
||||||
@@ -539,7 +658,7 @@ return view.extend({
|
|||||||
'class': 'btn',
|
'class': 'btn',
|
||||||
'click': function () {
|
'click': function () {
|
||||||
const textarea = document.createElement('textarea');
|
const textarea = document.createElement('textarea');
|
||||||
textarea.value = '```txt\n' + formattedOutput + '\n```';
|
textarea.value = formattedOutput;
|
||||||
document.body.appendChild(textarea);
|
document.body.appendChild(textarea);
|
||||||
textarea.select();
|
textarea.select();
|
||||||
try {
|
try {
|
||||||
@@ -555,18 +674,175 @@ return view.extend({
|
|||||||
'click': ui.hideModal
|
'click': ui.hideModal
|
||||||
}, _('Close'))
|
}, _('Close'))
|
||||||
])
|
])
|
||||||
], 'large');
|
]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
if (modalElement && modalElement.parentElement) {
|
// Configurations Section
|
||||||
modalElement.parentElement.style.width = '90%';
|
o = s.taboption('diagnostics', form.Button, '_check_sing_box_connections');
|
||||||
modalElement.parentElement.style.maxWidth = '1200px';
|
o.title = _('Active Connections');
|
||||||
modalElement.parentElement.style.margin = '2rem auto';
|
o.description = _('View active sing-box network connections');
|
||||||
|
o.inputtitle = _('Check Connections');
|
||||||
|
o.inputstyle = 'apply';
|
||||||
|
o.onclick = function () {
|
||||||
|
return fs.exec('/etc/init.d/podkop', ['check_sing_box_connections'])
|
||||||
|
.then(function (res) {
|
||||||
|
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
||||||
|
ui.showModal(_('Active Connections'), [
|
||||||
|
E('div', {
|
||||||
|
style:
|
||||||
|
'max-height: 70vh;' +
|
||||||
|
'overflow-y: auto;' +
|
||||||
|
'margin: 1em 0;' +
|
||||||
|
'padding: 1.5em;' +
|
||||||
|
'background: #f8f9fa;' +
|
||||||
|
'border: 1px solid #e9ecef;' +
|
||||||
|
'border-radius: 4px;' +
|
||||||
|
'font-family: monospace;' +
|
||||||
|
'white-space: pre-wrap;' +
|
||||||
|
'word-wrap: break-word;' +
|
||||||
|
'line-height: 1.5;' +
|
||||||
|
'font-size: 14px;'
|
||||||
|
}, [
|
||||||
|
E('pre', { style: 'margin: 0;' }, formattedOutput)
|
||||||
|
]),
|
||||||
|
E('div', {
|
||||||
|
style: 'display: flex; justify-content: space-between; margin-top: 1em;'
|
||||||
|
}, [
|
||||||
|
E('button', {
|
||||||
|
'class': 'btn',
|
||||||
|
'click': function () {
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.value = formattedOutput;
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
try {
|
||||||
|
document.execCommand('copy');
|
||||||
|
} catch (err) {
|
||||||
|
ui.addNotification(null, E('p', {}, _('Failed to copy: ') + err.message));
|
||||||
}
|
}
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
}
|
||||||
|
}, _('Copy to Clipboard')),
|
||||||
|
E('button', {
|
||||||
|
'class': 'btn',
|
||||||
|
'click': ui.hideModal
|
||||||
|
}, _('Close'))
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
o = s.taboption('diagnostics', form.Button, '_check_dnsmasq');
|
||||||
|
o.title = _('DNSMasq Configuration');
|
||||||
|
o.description = _('View current DNSMasq configuration settings');
|
||||||
|
o.inputtitle = _('Check DNSMasq');
|
||||||
|
o.inputstyle = 'apply';
|
||||||
|
o.onclick = function () {
|
||||||
|
return fs.exec('/etc/init.d/podkop', ['check_dnsmasq'])
|
||||||
|
.then(function (res) {
|
||||||
|
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
||||||
|
ui.showModal(_('DNSMasq Configuration'), [
|
||||||
|
E('div', {
|
||||||
|
style:
|
||||||
|
'max-height: 70vh;' +
|
||||||
|
'overflow-y: auto;' +
|
||||||
|
'margin: 1em 0;' +
|
||||||
|
'padding: 1.5em;' +
|
||||||
|
'background: #f8f9fa;' +
|
||||||
|
'border: 1px solid #e9ecef;' +
|
||||||
|
'border-radius: 4px;' +
|
||||||
|
'font-family: monospace;' +
|
||||||
|
'white-space: pre-wrap;' +
|
||||||
|
'word-wrap: break-word;' +
|
||||||
|
'line-height: 1.5;' +
|
||||||
|
'font-size: 14px;'
|
||||||
|
}, [
|
||||||
|
E('pre', { style: 'margin: 0;' }, formattedOutput)
|
||||||
|
]),
|
||||||
|
E('div', {
|
||||||
|
style: 'display: flex; justify-content: space-between; margin-top: 1em;'
|
||||||
|
}, [
|
||||||
|
E('button', {
|
||||||
|
'class': 'btn',
|
||||||
|
'click': function () {
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.value = formattedOutput;
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
try {
|
||||||
|
document.execCommand('copy');
|
||||||
|
} catch (err) {
|
||||||
|
ui.addNotification(null, E('p', {}, _('Failed to copy: ') + err.message));
|
||||||
|
}
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
}
|
||||||
|
}, _('Copy to Clipboard')),
|
||||||
|
E('button', {
|
||||||
|
'class': 'btn',
|
||||||
|
'click': ui.hideModal
|
||||||
|
}, _('Close'))
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
o = s.taboption('diagnostics', form.Button, '_show_sing_box_config');
|
||||||
|
o.title = _('Sing-Box Configuration');
|
||||||
|
o.description = _('Show current sing-box configuration');
|
||||||
|
o.inputtitle = _('Show Sing-Box Config');
|
||||||
|
o.inputstyle = 'apply';
|
||||||
|
o.onclick = function () {
|
||||||
|
return fs.exec('/etc/init.d/podkop', ['show_sing_box_config'])
|
||||||
|
.then(function (res) {
|
||||||
|
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
||||||
|
ui.showModal(_('Sing-Box Configuration'), [
|
||||||
|
E('div', {
|
||||||
|
style:
|
||||||
|
'max-height: 70vh;' +
|
||||||
|
'overflow-y: auto;' +
|
||||||
|
'margin: 1em 0;' +
|
||||||
|
'padding: 1.5em;' +
|
||||||
|
'background: #f8f9fa;' +
|
||||||
|
'border: 1px solid #e9ecef;' +
|
||||||
|
'border-radius: 4px;' +
|
||||||
|
'font-family: monospace;' +
|
||||||
|
'white-space: pre-wrap;' +
|
||||||
|
'word-wrap: break-word;' +
|
||||||
|
'line-height: 1.5;' +
|
||||||
|
'font-size: 14px;'
|
||||||
|
}, [
|
||||||
|
E('pre', { style: 'margin: 0;' }, formattedOutput)
|
||||||
|
]),
|
||||||
|
E('div', {
|
||||||
|
style: 'display: flex; justify-content: space-between; margin-top: 1em;'
|
||||||
|
}, [
|
||||||
|
E('button', {
|
||||||
|
'class': 'btn',
|
||||||
|
'click': function () {
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.value = '```json\n' + formattedOutput + '\n```';
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
try {
|
||||||
|
document.execCommand('copy');
|
||||||
|
} catch (err) {
|
||||||
|
ui.addNotification(null, E('p', {}, _('Failed to copy: ') + err.message));
|
||||||
|
}
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
}
|
||||||
|
}, _('Copy to Clipboard')),
|
||||||
|
E('button', {
|
||||||
|
'class': 'btn',
|
||||||
|
'click': ui.hideModal
|
||||||
|
}, _('Close'))
|
||||||
|
])
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
o = s.taboption('diagnostics', form.Button, '_show_config');
|
o = s.taboption('diagnostics', form.Button, '_show_config');
|
||||||
o.title = _('Show Config');
|
o.title = _('Podkop Configuration');
|
||||||
o.description = _('Show current podkop configuration with masked sensitive data');
|
o.description = _('Show current podkop configuration with masked sensitive data');
|
||||||
o.inputtitle = _('Show Config');
|
o.inputtitle = _('Show Config');
|
||||||
o.inputstyle = 'apply';
|
o.inputstyle = 'apply';
|
||||||
@@ -574,60 +850,69 @@ return view.extend({
|
|||||||
return fs.exec('/etc/init.d/podkop', ['show_config'])
|
return fs.exec('/etc/init.d/podkop', ['show_config'])
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
||||||
|
ui.showModal(_('Podkop Configuration'), [
|
||||||
const modalElement = ui.showModal(_('Podkop Configuration'), [
|
E('div', {
|
||||||
E('div', { class: 'cbi-section' }, [
|
style:
|
||||||
E('pre', { class: 'cbi-value-field' }, formattedOutput)
|
'max-height: 70vh;' +
|
||||||
|
'overflow-y: auto;' +
|
||||||
|
'margin: 1em 0;' +
|
||||||
|
'padding: 1.5em;' +
|
||||||
|
'background: #f8f9fa;' +
|
||||||
|
'border: 1px solid #e9ecef;' +
|
||||||
|
'border-radius: 4px;' +
|
||||||
|
'font-family: monospace;' +
|
||||||
|
'white-space: pre-wrap;' +
|
||||||
|
'word-wrap: break-word;' +
|
||||||
|
'line-height: 1.5;' +
|
||||||
|
'font-size: 14px;'
|
||||||
|
}, [
|
||||||
|
E('pre', { style: 'margin: 0;' }, formattedOutput)
|
||||||
]),
|
]),
|
||||||
E('div', { style: 'display: flex; justify-content: space-between; margin-top: 1em;' }, [
|
E('div', {
|
||||||
|
style: 'display: flex; justify-content: space-between; margin-top: 1em;'
|
||||||
|
}, [
|
||||||
E('button', {
|
E('button', {
|
||||||
'class': 'btn cbi-button-save',
|
'class': 'btn',
|
||||||
'click': function () {
|
'click': function () {
|
||||||
const textarea = document.createElement('textarea');
|
const textarea = document.createElement('textarea');
|
||||||
textarea.value = '```\n' + formattedOutput + '\n```';
|
textarea.value = formattedOutput;
|
||||||
document.body.appendChild(textarea);
|
document.body.appendChild(textarea);
|
||||||
textarea.select();
|
textarea.select();
|
||||||
try {
|
try {
|
||||||
document.execCommand('copy');
|
document.execCommand('copy');
|
||||||
ui.hideModal();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ui.addNotification(null, E('p', {}, _('Failed to copy: ') + err.message));
|
ui.addNotification(null, E('p', {}, _('Failed to copy: ') + err.message));
|
||||||
}
|
}
|
||||||
document.body.removeChild(textarea);
|
document.body.removeChild(textarea);
|
||||||
}
|
}
|
||||||
}, _('Copy to Clipboard')),
|
}, _('Copy to Clipboard')),
|
||||||
E('button', {
|
|
||||||
'class': 'btn cbi-button-neutral',
|
|
||||||
'click': ui.hideModal
|
|
||||||
}, _('Close'))
|
|
||||||
])
|
|
||||||
], 'large');
|
|
||||||
|
|
||||||
if (modalElement && modalElement.parentElement) {
|
|
||||||
modalElement.parentElement.classList.add('modal-overlay-large');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
o = s.taboption('diagnostics', form.Button, '_list_update');
|
|
||||||
o.title = _('Update lists');
|
|
||||||
o.description = _('Update all lists in config');
|
|
||||||
o.inputtitle = _('Update lists');
|
|
||||||
o.inputstyle = 'apply';
|
|
||||||
o.onclick = function () {
|
|
||||||
fs.exec('/etc/init.d/podkop', ['list_update']);
|
|
||||||
|
|
||||||
ui.showModal(_('List Update'), [
|
|
||||||
E('p', {}, _('Lists will be updated in background. You can check the progress in system logs.')),
|
|
||||||
E('div', { class: 'right' }, [
|
|
||||||
E('button', {
|
E('button', {
|
||||||
'class': 'btn',
|
'class': 'btn',
|
||||||
'click': ui.hideModal
|
'click': ui.hideModal
|
||||||
}, _('Close'))
|
}, _('Close'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
o = s.taboption('diagnostics', form.Button, '_list_update');
|
||||||
|
o.title = _('Update Lists');
|
||||||
|
o.description = _('Update all lists in config');
|
||||||
|
o.inputtitle = _('Update Lists');
|
||||||
|
o.inputstyle = 'apply';
|
||||||
|
o.onclick = function () {
|
||||||
|
return fs.exec('/etc/init.d/podkop', ['list_update'])
|
||||||
|
.then(function (res) {
|
||||||
|
const formattedOutput = formatDiagnosticOutput(res.stdout || _('No output'));
|
||||||
|
ui.showModal(_('Lists Update Results'), [
|
||||||
|
E('div', { style: 'white-space:pre-wrap;padding:5px' }, formattedOutput),
|
||||||
|
E('div', { class: 'right' }, E('button', {
|
||||||
|
class: 'btn',
|
||||||
|
click: ui.hideModal
|
||||||
|
}, _('Close')))
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// Add new section 'extra'
|
// Add new section 'extra'
|
||||||
var s = m.section(form.TypedSection, 'extra', _('Extra configurations'));
|
var s = m.section(form.TypedSection, 'extra', _('Extra configurations'));
|
||||||
|
|||||||
@@ -330,3 +330,151 @@ msgstr "Просмотр логов"
|
|||||||
|
|
||||||
msgid "Failed to copy logs: "
|
msgid "Failed to copy logs: "
|
||||||
msgstr "Ошибка копирования логов: "
|
msgstr "Ошибка копирования логов: "
|
||||||
|
|
||||||
|
msgid "Show Config"
|
||||||
|
msgstr "Показать конфигурацию"
|
||||||
|
|
||||||
|
msgid "Show current podkop configuration with masked sensitive data"
|
||||||
|
msgstr "Показать текущую конфигурацию podkop с маскированными конфиденциальными данными"
|
||||||
|
|
||||||
|
msgid "Podkop Configuration"
|
||||||
|
msgstr "Конфигурация Podkop"
|
||||||
|
|
||||||
|
msgid "Update lists"
|
||||||
|
msgstr "Обновить списки"
|
||||||
|
|
||||||
|
msgid "Update all lists in config"
|
||||||
|
msgstr "Обновить все списки в конфигурации"
|
||||||
|
|
||||||
|
msgid "List Update"
|
||||||
|
msgstr "Обновление списков"
|
||||||
|
|
||||||
|
msgid "Lists will be updated in background. You can check the progress in system logs."
|
||||||
|
msgstr "Списки будут обновлены в фоновом режиме. Вы можете проверить прогресс в системных логах."
|
||||||
|
|
||||||
|
msgid "Extra configurations"
|
||||||
|
msgstr "Дополнительные конфигурации"
|
||||||
|
|
||||||
|
msgid "Extra configuration"
|
||||||
|
msgstr "Дополнительная конфигурация"
|
||||||
|
|
||||||
|
msgid "Add Section"
|
||||||
|
msgstr "Добавить раздел"
|
||||||
|
|
||||||
|
msgid "QUIC disable"
|
||||||
|
msgstr "Отключить QUIC"
|
||||||
|
|
||||||
|
msgid "For issues with the video stream"
|
||||||
|
msgstr "Для проблем с видеопотоком"
|
||||||
|
|
||||||
|
msgid "Community Lists"
|
||||||
|
msgstr "Списки сообщества"
|
||||||
|
|
||||||
|
msgid "Local Domain Lists"
|
||||||
|
msgstr "Локальные списки доменов"
|
||||||
|
|
||||||
|
msgid "Use the list from the router filesystem"
|
||||||
|
msgstr "Использовать список из файловой системы роутера"
|
||||||
|
|
||||||
|
msgid "Local Domain Lists Path"
|
||||||
|
msgstr "Путь к локальным спискам доменов"
|
||||||
|
|
||||||
|
msgid "Enter to the list file path"
|
||||||
|
msgstr "Введите путь к файлу списка"
|
||||||
|
|
||||||
|
msgid "Proxy Check"
|
||||||
|
msgstr "Проверка прокси"
|
||||||
|
|
||||||
|
msgid "Check if sing-box proxy works correctly"
|
||||||
|
msgstr "Проверить корректность работы прокси sing-box"
|
||||||
|
|
||||||
|
msgid "Check Proxy"
|
||||||
|
msgstr "Проверить прокси"
|
||||||
|
|
||||||
|
msgid "Proxy Check Results"
|
||||||
|
msgstr "Результаты проверки прокси"
|
||||||
|
|
||||||
|
msgid "NFT Rules"
|
||||||
|
msgstr "Правила NFT"
|
||||||
|
|
||||||
|
msgid "Show current nftables rules and statistics"
|
||||||
|
msgstr "Показать текущие правила и статистику nftables"
|
||||||
|
|
||||||
|
msgid "Check Rules"
|
||||||
|
msgstr "Проверить правила"
|
||||||
|
|
||||||
|
msgid "GitHub Connectivity"
|
||||||
|
msgstr "Подключение к GitHub"
|
||||||
|
|
||||||
|
msgid "Check GitHub connectivity and lists availability"
|
||||||
|
msgstr "Проверить подключение к GitHub и доступность списков"
|
||||||
|
|
||||||
|
msgid "Check GitHub"
|
||||||
|
msgstr "Проверить GitHub"
|
||||||
|
|
||||||
|
msgid "GitHub Connectivity Results"
|
||||||
|
msgstr "Результаты проверки подключения к GitHub"
|
||||||
|
|
||||||
|
msgid "Sing-Box Logs"
|
||||||
|
msgstr "Логи Sing-Box"
|
||||||
|
|
||||||
|
msgid "View recent sing-box logs from system journal"
|
||||||
|
msgstr "Просмотр последних логов sing-box из системного журнала"
|
||||||
|
|
||||||
|
msgid "View Sing-Box Logs"
|
||||||
|
msgstr "Просмотр логов Sing-Box"
|
||||||
|
|
||||||
|
msgid "Podkop Logs"
|
||||||
|
msgstr "Логи Podkop"
|
||||||
|
|
||||||
|
msgid "View recent podkop logs from system journal"
|
||||||
|
msgstr "Просмотр последних логов podkop из системного журнала"
|
||||||
|
|
||||||
|
msgid "View Podkop Logs"
|
||||||
|
msgstr "Просмотр логов Podkop"
|
||||||
|
|
||||||
|
msgid "Active Connections"
|
||||||
|
msgstr "Активные соединения"
|
||||||
|
|
||||||
|
msgid "View active sing-box network connections"
|
||||||
|
msgstr "Просмотр активных сетевых соединений sing-box"
|
||||||
|
|
||||||
|
msgid "Check Connections"
|
||||||
|
msgstr "Проверить соединения"
|
||||||
|
|
||||||
|
msgid "DNSMasq Configuration"
|
||||||
|
msgstr "Конфигурация DNSMasq"
|
||||||
|
|
||||||
|
msgid "View current DNSMasq configuration settings"
|
||||||
|
msgstr "Просмотр текущих настроек конфигурации DNSMasq"
|
||||||
|
|
||||||
|
msgid "Check DNSMasq"
|
||||||
|
msgstr "Проверить DNSMasq"
|
||||||
|
|
||||||
|
msgid "Sing-Box Configuration"
|
||||||
|
msgstr "Конфигурация Sing-Box"
|
||||||
|
|
||||||
|
msgid "Show current sing-box configuration"
|
||||||
|
msgstr "Показать текущую конфигурацию sing-box"
|
||||||
|
|
||||||
|
msgid "Show Sing-Box Config"
|
||||||
|
msgstr "Показать конфигурацию Sing-Box"
|
||||||
|
|
||||||
|
msgid "Lists Update Results"
|
||||||
|
msgstr "Результаты обновления списков"
|
||||||
|
|
||||||
|
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
|
||||||
|
msgid "Warning: %s cannot be used together with %s. Previous selections have been removed."
|
||||||
|
msgstr "Предупреждение: %s нельзя использовать вместе с %s. Предыдущие варианты были удалены."
|
||||||
|
|
||||||
|
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
|
||||||
|
msgid "Warning: Russia inside can only be used with Meta, Twitter, Discord, and Telegram. %s have been removed from selection."
|
||||||
|
msgstr "Внимание: Russia inside может использоваться только с Meta, Twitter, Discord и Telegram. %s были удалены из выбора."
|
||||||
|
|
||||||
|
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
|
||||||
|
msgid "Regional options cannot be used together"
|
||||||
|
msgstr "Нельзя использовать несколько региональных опций"
|
||||||
|
|
||||||
|
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
|
||||||
|
msgid "Russia inside restrictions"
|
||||||
|
msgstr "Ограничения Russia inside"
|
||||||
@@ -330,3 +330,151 @@ msgstr ""
|
|||||||
|
|
||||||
msgid "Failed to copy logs: "
|
msgid "Failed to copy logs: "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Show Config"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Show current podkop configuration with masked sensitive data"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Podkop Configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Update lists"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Update all lists in config"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "List Update"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Lists will be updated in background. You can check the progress in system logs."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Extra configurations"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Extra configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Add Section"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "QUIC disable"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "For issues with the video stream"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Community Lists"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Local Domain Lists"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Use the list from the router filesystem"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Local Domain Lists Path"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Enter to the list file path"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Proxy Check"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Check if sing-box proxy works correctly"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Check Proxy"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Proxy Check Results"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "NFT Rules"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Show current nftables rules and statistics"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Check Rules"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "GitHub Connectivity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Check GitHub connectivity and lists availability"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Check GitHub"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "GitHub Connectivity Results"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Sing-Box Logs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "View recent sing-box logs from system journal"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "View Sing-Box Logs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Podkop Logs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "View recent podkop logs from system journal"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "View Podkop Logs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Active Connections"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "View active sing-box network connections"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Check Connections"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "DNSMasq Configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "View current DNSMasq configuration settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Check DNSMasq"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Sing-Box Configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Show current sing-box configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Show Sing-Box Config"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Lists Update Results"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
|
||||||
|
msgid "Warning: %s cannot be used together with %s. Previous selections have been removed."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
|
||||||
|
msgid "Warning: Russia inside can only be used with Meta, Twitter, Discord, and Telegram. %s have been removed from selection."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
|
||||||
|
msgid "Regional options cannot be used together"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
|
||||||
|
msgid "Russia inside restrictions"
|
||||||
|
msgstr ""
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=podkop
|
PKG_NAME:=podkop
|
||||||
PKG_VERSION:=0.3.7
|
PKG_VERSION:=0.3.10
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_MAINTAINER:=ITDog <podkop@itdog.info>
|
PKG_MAINTAINER:=ITDog <podkop@itdog.info>
|
||||||
@@ -33,6 +33,8 @@ define Package/podkop/prerm
|
|||||||
|
|
||||||
grep -q "105 podkop" /etc/iproute2/rt_tables && sed -i "/105 podkop/d" /etc/iproute2/rt_tables
|
grep -q "105 podkop" /etc/iproute2/rt_tables && sed -i "/105 podkop/d" /etc/iproute2/rt_tables
|
||||||
|
|
||||||
|
/etc/init.d/podkop stop
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,18 @@ script=$(readlink "$initscript")
|
|||||||
NAME="$(basename ${script:-$initscript})"
|
NAME="$(basename ${script:-$initscript})"
|
||||||
config_load "$NAME"
|
config_load "$NAME"
|
||||||
|
|
||||||
EXTRA_COMMANDS="list_update check_proxy check_nft check_github check_logs check_all check_three main show_config show_version"
|
EXTRA_COMMANDS="main list_update check_proxy check_nft check_github check_logs check_sing_box_connections check_sing_box_logs check_dnsmasq show_config show_version show_sing_box_config"
|
||||||
EXTRA_HELP=" list_update Updating domain and subnet lists
|
EXTRA_HELP=" list_update Updating domain and subnet lists
|
||||||
sing_box_config_vless For test vless string
|
|
||||||
check_proxy Check if sing-box proxy works correctly
|
check_proxy Check if sing-box proxy works correctly
|
||||||
check_nft Show PodkopTable nftables rules
|
check_nft Show PodkopTable nftables rules
|
||||||
check_github Check GitHub connectivity and lists availability
|
check_github Check GitHub connectivity and lists availability
|
||||||
check_logs Show podkop logs from system journal
|
check_logs Show podkop logs from system journal
|
||||||
check_all Run all checks
|
check_sing_box_connections Show active sing-box network connections
|
||||||
check_three Run check_proxy, check_nft and check_github
|
check_sing_box_logs Show recent sing-box logs
|
||||||
main Main function
|
check_dnsmasq Show current DNSMasq configuration
|
||||||
show_config Show current configuration with masked sensitive data
|
show_config Show current configuration with masked sensitive data
|
||||||
show_version Show current version"
|
show_version Show current version
|
||||||
|
show_sing_box_config Show current sing-box configuration"
|
||||||
|
|
||||||
[ ! -L /usr/sbin/podkop ] && ln -s /etc/init.d/podkop /usr/sbin/podkop
|
[ ! -L /usr/sbin/podkop ] && ln -s /etc/init.d/podkop /usr/sbin/podkop
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ SUBNETS_TELERAM="${GITHUB_RAW_URL}/Subnets/IPv4/telegram.lst"
|
|||||||
SING_BOX_CONFIG="/etc/sing-box/config.json"
|
SING_BOX_CONFIG="/etc/sing-box/config.json"
|
||||||
CACHE_FILE_PATH="/tmp/cache.db"
|
CACHE_FILE_PATH="/tmp/cache.db"
|
||||||
FAKEIP="198.18.0.0/15"
|
FAKEIP="198.18.0.0/15"
|
||||||
|
VALID_SERVICES="russia_inside russia_outside ukraine_inside geoblock block porn news anime youtube discord meta twitter hdrezka tiktok telegram"
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
log "Start podkop"
|
log "Start podkop"
|
||||||
@@ -48,8 +49,7 @@ start_service() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if opkg list-installed | grep -qE "iptables|kmod-iptab"; then
|
if opkg list-installed | grep -qE "iptables|kmod-iptab"; then
|
||||||
echo "Found incompatible iptables packages. If you're using FriendlyWrt: https://t.me/itdogchat/44512/181082"
|
printf "\033[31;1mFound incompatible iptables packages. If you're using FriendlyWrt: https://t.me/itdogchat/44512/181082\033[0m\n"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ip addr | grep -q "br-lan"; then
|
if ! ip addr | grep -q "br-lan"; then
|
||||||
@@ -59,6 +59,8 @@ start_service() {
|
|||||||
|
|
||||||
migration
|
migration
|
||||||
|
|
||||||
|
config_foreach process_validate_service
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
procd_set_param command /bin/sh -c "/etc/init.d/podkop main &"
|
procd_set_param command /bin/sh -c "/etc/init.d/podkop main &"
|
||||||
procd_set_param stdout 1
|
procd_set_param stdout 1
|
||||||
@@ -71,7 +73,7 @@ stop_service() {
|
|||||||
remove_cron_job
|
remove_cron_job
|
||||||
dnsmasq_rm
|
dnsmasq_rm
|
||||||
|
|
||||||
rm -rf /tmp/podkop/*
|
rm -rf /tmp/podkop/*.lst
|
||||||
|
|
||||||
log "Flush nft"
|
log "Flush nft"
|
||||||
if nft list table inet PodkopTable >/dev/null 2>&1; then
|
if nft list table inet PodkopTable >/dev/null 2>&1; then
|
||||||
@@ -202,7 +204,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Migrations funcs
|
# Migrations and validation funcs
|
||||||
migration() {
|
migration() {
|
||||||
# list migrate
|
# list migrate
|
||||||
local CONFIG="/etc/config/podkop"
|
local CONFIG="/etc/config/podkop"
|
||||||
@@ -247,6 +249,26 @@ migration() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate_service() {
|
||||||
|
local domain="$1"
|
||||||
|
|
||||||
|
for valid_service in $VALID_SERVICES; do
|
||||||
|
if [ "$domain" = "$valid_service" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
log "Invalid service in domain_list: $domain. Exiting. Check config and LuCI cache"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
process_validate_service() {
|
||||||
|
config_get_bool domain_list_enabled "$section" "domain_list_enabled" "0"
|
||||||
|
if [ "$domain_list_enabled" -eq 1 ]; then
|
||||||
|
config_list_foreach "$section" domain_list validate_service
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Main funcs
|
# Main funcs
|
||||||
|
|
||||||
route_table_rule_mark() {
|
route_table_rule_mark() {
|
||||||
@@ -308,6 +330,7 @@ dnsmasq_rm() {
|
|||||||
uci set dhcp.@dnsmasq[0].filter_aaaa="0"
|
uci set dhcp.@dnsmasq[0].filter_aaaa="0"
|
||||||
uci set dhcp.@dnsmasq[0].cachesize="1000"
|
uci set dhcp.@dnsmasq[0].cachesize="1000"
|
||||||
uci -q delete dhcp.@dnsmasq[0].server
|
uci -q delete dhcp.@dnsmasq[0].server
|
||||||
|
uci add_list dhcp.@dnsmasq[0].server="8.8.8.8"
|
||||||
uci commit dhcp
|
uci commit dhcp
|
||||||
|
|
||||||
/etc/init.d/dnsmasq restart
|
/etc/init.d/dnsmasq restart
|
||||||
@@ -1187,8 +1210,11 @@ process_remote_ruleset() {
|
|||||||
sing_box_rule_preset() {
|
sing_box_rule_preset() {
|
||||||
config_get custom_domains_list_type "$section" "custom_domains_list_type"
|
config_get custom_domains_list_type "$section" "custom_domains_list_type"
|
||||||
config_get custom_subnets_list_enabled "$section" "custom_subnets_list_enabled"
|
config_get custom_subnets_list_enabled "$section" "custom_subnets_list_enabled"
|
||||||
|
config_get custom_local_domains_list_enabled "$section" "custom_local_domains_list_enabled"
|
||||||
|
config_get custom_download_domains_list_enabled "$section" "custom_download_domains_list_enabled"
|
||||||
|
|
||||||
if [ "$custom_domains_list_type" != "disabled" ] || [ "$custom_subnets_list_enabled" != "disabled" ]; then
|
if [ "$custom_domains_list_type" != "disabled" ] || [ "$custom_subnets_list_enabled" != "disabled" ] ||
|
||||||
|
[ "$custom_local_domains_list_enabled" = "1" ] || [ "$custom_download_domains_list_enabled" = "1" ]; then
|
||||||
sing_box_rules "$section" "$section"
|
sing_box_rules "$section" "$section"
|
||||||
sing_box_dns_rule_fakeip_section "$section" "$section"
|
sing_box_dns_rule_fakeip_section "$section" "$section"
|
||||||
fi
|
fi
|
||||||
@@ -1370,7 +1396,21 @@ check_proxy() {
|
|||||||
walk(
|
walk(
|
||||||
if type == "object" then
|
if type == "object" then
|
||||||
with_entries(
|
with_entries(
|
||||||
if [.key] | inside(["uuid", "server", "server_name", "password", "public_key", "short_id"]) then
|
if .key == "uuid" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "server" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "server_name" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "password" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "public_key" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "short_id" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "fingerprint" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "server_port" then
|
||||||
.value = "MASKED"
|
.value = "MASKED"
|
||||||
else . end
|
else . end
|
||||||
)
|
)
|
||||||
@@ -1414,22 +1454,18 @@ check_nft() {
|
|||||||
|
|
||||||
nolog "Checking PodkopTable rules..."
|
nolog "Checking PodkopTable rules..."
|
||||||
|
|
||||||
local sets="podkop_domains podkop_subnets podkop_subnets_discord localv4"
|
# Check if table exists
|
||||||
|
if ! nft list table inet PodkopTable >/dev/null 2>&1; then
|
||||||
nolog "Sets statistics:"
|
nolog "PodkopTable not found"
|
||||||
for set_name in $sets; do
|
return 1
|
||||||
if nft list set inet PodkopTable $set_name >/dev/null 2>&1; then
|
|
||||||
local count=$(nft list set inet PodkopTable $set_name 2>/dev/null | grep -c ",")
|
|
||||||
nolog "- $set_name: $count elements"
|
|
||||||
else
|
|
||||||
nolog "- $set_name: not found"
|
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
nolog "Current chains and rules:"
|
# Get all sets
|
||||||
nft list table inet PodkopTable | grep "chain\|counter"
|
nolog "\nSets configuration:"
|
||||||
|
|
||||||
nolog "NFT check completed"
|
nft list table inet PodkopTable
|
||||||
|
|
||||||
|
nolog "\nNFT check completed"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_github() {
|
check_github() {
|
||||||
@@ -1454,37 +1490,94 @@ check_github() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_dnsmasq() {
|
||||||
|
nolog "Checking dnsmasq configuration..."
|
||||||
|
|
||||||
|
local config=$(uci show dhcp.@dnsmasq[0])
|
||||||
|
if [ -z "$config" ]; then
|
||||||
|
nolog "No dnsmasq configuration found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$config" | while IFS='=' read -r key value; do
|
||||||
|
nolog "$key = $value"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
check_sing_box_connections() {
|
||||||
|
nolog "Checking sing-box connections..."
|
||||||
|
|
||||||
|
if ! command -v netstat >/dev/null 2>&1; then
|
||||||
|
nolog "netstat is not installed"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local connections=$(netstat -tuanp | grep sing-box)
|
||||||
|
if [ -z "$connections" ]; then
|
||||||
|
nolog "No active sing-box connections found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$connections" | while read -r line; do
|
||||||
|
nolog "$line"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
check_sing_box_logs() {
|
||||||
|
nolog "Showing sing-box logs from system journal..."
|
||||||
|
|
||||||
|
local logs=$(logread -e sing-box | tail -n 50)
|
||||||
|
if [ -z "$logs" ]; then
|
||||||
|
nolog "No sing-box logs found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$logs"
|
||||||
|
}
|
||||||
|
|
||||||
check_logs() {
|
check_logs() {
|
||||||
nolog "Showing podkop logs from system journal..."
|
nolog "Showing podkop logs from system journal..."
|
||||||
|
|
||||||
if command -v logread >/dev/null 2>&1; then
|
if command -v logread >/dev/null 2>&1; then
|
||||||
logread -e "podkop" | tail -n 50
|
logread -e podkop | tail -n 50
|
||||||
else
|
else
|
||||||
nolog "Error: logread command not found"
|
nolog "Error: logread command not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_three() {
|
show_sing_box_config() {
|
||||||
nolog "\n=== Checking GitHub connectivity ==="
|
nolog "Current sing-box configuration:"
|
||||||
check_github
|
|
||||||
|
|
||||||
nolog "\n=== Checking proxy settings ==="
|
if [ ! -f "$SING_BOX_CONFIG" ]; then
|
||||||
check_proxy
|
nolog "Configuration file not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
nolog "\n=== Checking NFT rules ==="
|
jq '
|
||||||
check_nft
|
walk(
|
||||||
|
if type == "object" then
|
||||||
nolog "\nFull diagnostic check completed"
|
with_entries(
|
||||||
}
|
if .key == "uuid" then
|
||||||
|
.value = "MASKED"
|
||||||
check_all() {
|
elif .key == "server" then
|
||||||
nolog "Starting full diagnostic check..."
|
.value = "MASKED"
|
||||||
|
elif .key == "server_name" then
|
||||||
nolog "\n=== Checking recent logs ==="
|
.value = "MASKED"
|
||||||
check_logs
|
elif .key == "password" then
|
||||||
|
.value = "MASKED"
|
||||||
check_three
|
elif .key == "public_key" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "short_id" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "fingerprint" then
|
||||||
|
.value = "MASKED"
|
||||||
|
elif .key == "server_port" then
|
||||||
|
.value = "MASKED"
|
||||||
|
else . end
|
||||||
|
)
|
||||||
|
else . end
|
||||||
|
)' "$SING_BOX_CONFIG"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_config() {
|
show_config() {
|
||||||
|
|||||||
Reference in New Issue
Block a user