Compare commits

..

66 Commits

Author SHA1 Message Date
itdoginfo
7ee92123bc Fix use-application-dns.net 2025-02-19 23:08:38 +03:00
itdoginfo
5fd0e23cf9 Added backup dhcp and don't touch dhcp. Firefox disable doh FQDN moved to sing-box 2025-02-19 22:40:17 +03:00
itdoginfo
9b25669c8f Merge #30 and #31 2025-02-19 19:48:36 +03:00
itdoginfo
4b020671cc Merge pull request #30 from itdoginfo/feature/web-versions-view
feat: add version information tab to diagnostics
2025-02-19 19:42:40 +03:00
Ivan K
6222221847 docs: update Russian translations and add new strings for FakeIP status check 2025-02-19 19:18:22 +03:00
itdoginfo
6fa215e343 Merge pull request #31 from vernette/feature/dns-check
feat(podkop): add secure DNS probe domain configuration
2025-02-19 18:23:34 +03:00
Nikita Skryabin
a33835415f feat(init.d/podkop): add secure DNS probe domain configuration 2025-02-19 13:11:22 +03:00
Ivan K
f76c657bd7 style: remove unused CSS and JavaScript for tooltips 2025-02-18 22:11:58 +03:00
Ivan K
cceedd6c17 docs: update Russian translations for error messages and UI strings 2025-02-18 21:27:56 +03:00
Ivan K
8fa1986961 docs: update Russian translations for luci-app-podkop 2025-02-18 21:20:15 +03:00
Ivan K
8dec59d118 docs: update Russian translations for new UI elements in luci-app-podkop 2025-02-18 21:17:02 +03:00
Ivan K
c1fac487c7 style: add tooltip functionality and adjust CSS for better UI 2025-02-18 21:05:02 +03:00
Ivan K
d934bcc5e9 refactor: add async to diagnostics section UI 2025-02-18 18:56:34 +03:00
Ivan K
fc99bd7aaa feat: add spacing and line break to diagnostic tools section 2025-02-18 18:28:52 +03:00
Ivan K
b6cf73b974 feat: add service status and diagnostic tools to podkop UI 2025-02-18 18:23:29 +03:00
Ivan K
6df7c8abf8 feat: add URL validation for Shadowsocks and VLESS configurations from examples 2025-02-18 17:18:34 +03:00
Ivan K
8eb97a8023 Merge remote-tracking branch 'origin/main' into feature/web-versions-view 2025-02-18 14:05:22 +03:00
Ivan K
cd43449585 feat: add version information tab to diagnostics 2025-02-18 13:59:04 +03:00
itdoginfo
16c174d624 v0.3.10 2025-02-18 13:21:52 +03:00
itdoginfo
1c02a2208b Stop service before rm 2025-02-18 13:21:31 +03:00
itdoginfo
2c93e98755 Merge pull request #29 from itdoginfo/feature/web-versions-view
feat: add validation and warning messages for regional lists
2025-02-18 13:16:04 +03:00
Ivan K
66b179f282 fix: add extra configurations section to podkop.js 2025-02-18 13:01:15 +03:00
itdoginfo
4bbaae776c Merge pull request #28 from vernette/main
fix(install): resolve update failure due to improper cleanup
2025-02-18 12:52:30 +03:00
Ivan K
e31f313819 feat: add validation and warning messages for regional options in podkop.js 2025-02-18 12:49:24 +03:00
unknown
bd0e33781f fix(install): correct continue logic for existing package files 2025-02-18 12:06:33 +03:00
Nikita Skryabin
ade2b844ec fix(init.d/podkop): change rm command to remove only *.lst files in /tmp/podkop directory 2025-02-18 10:05:34 +03:00
Nikita Skryabin
6f997a6e73 refactor(install.sh): improve download retry logic 2025-02-18 09:59:01 +03:00
Nikita Skryabin
744de6aec2 chore(install.sh): replace rm command with find 2025-02-18 09:45:49 +03:00
itdoginfo
ae06de8189 v0.3.9 2025-02-17 23:36:53 +03:00
itdoginfo
1663f6665f Fix #27, added copy and div 2025-02-17 23:36:37 +03:00
itdoginfo
b005cbe50e Fix rule for section custom_download 2025-02-17 19:42:39 +03:00
itdoginfo
6c752d59ce Merge pull request #27 from VizzleTF/main
Поправил диагностику
2025-02-17 19:41:26 +03:00
itdoginfo
dbdd0560bf Added CODEOWNERS 2025-02-17 19:21:07 +03:00
Ivan K
aeacd9d8fd docs: update README.md with installation instructions 2025-02-17 19:09:52 +03:00
Ivan K
ded0bff23a chore: update build workflow to simplify install script generation 2025-02-17 19:09:09 +03:00
Ivan K
80ab7caee9 chore: update build workflow to use git commit -am 2025-02-17 18:49:29 +03:00
Ivan K
516063310a refactor: update install script generation to use current version tag 2025-02-17 18:40:54 +03:00
Ivan K
c6d72aa781 docs: update README with installation instructions for specific version 2025-02-17 18:28:53 +03:00
Ivan K
91fa2a2859 Merge branch 'itdoginfo:main' into main 2025-02-17 18:08:37 +03:00
Ivan K
13e84afcf0 feat: add new diagnostic checks and update install script 2025-02-17 18:08:13 +03:00
itdoginfo
88c160d3f8 Fix 2025-02-17 17:22:45 +03:00
itdoginfo
ebd185f633 Added install for 0.2.5 2025-02-17 16:34:27 +03:00
itdoginfo
e86bffb720 v0.3.8 2025-02-17 16:04:34 +03:00
itdoginfo
fb65b63639 Merge pull request #25 from VizzleTF/main
docs(ru): add new translations for podkop configuration
2025-02-17 15:51:19 +03:00
itdoginfo
daf7e30ed1 dnsmasq add 8.8.8.8. Validate domain_list 2025-02-17 15:22:55 +03:00
itdoginfo
dd62ecfbeb Check sing-box 2025-02-17 13:20:28 +03:00
Ivan K
41cb8cd650 Merge branch 'itdoginfo:main' into main 2025-02-17 13:08:35 +03:00
Ivan K
b7ad256986 docs(ru): add new translations for podkop configuration 2025-02-17 13:07:11 +03:00
itdoginfo
f88ffa1893 Fix install logic 2025-02-17 12:44:48 +03:00
itdoginfo
6f604ca765 Update 2025-02-16 17:53:14 +03:00
itdoginfo
52c6eeae12 Fix version 2025-02-16 17:52:57 +03:00
itdoginfo
778f2897bc Fix check iptables 2025-02-16 17:41:58 +03:00
itdoginfo
ca7bb77356 Fix 2025-02-16 16:57:16 +03:00
itdoginfo
da8195b795 Fix migrate 2025-02-16 15:59:07 +03:00
itdoginfo
98129720bb rm until 2025-02-16 14:29:50 +03:00
itdoginfo
3c1865c8a3 Expanding checkes. DNS 127.0.0.42. QUIC disable. Some fixes 2025-02-16 14:18:19 +03:00
itdoginfo
77ac728d47 Check sing-box 2025-02-16 12:16:43 +03:00
itdoginfo
1b5cfa3371 Move check sing-box to start 2025-02-15 23:32:18 +03:00
itdoginfo
590e040958 v0.3.4 2025-02-15 22:23:55 +03:00
itdoginfo
2323d426dd tmp check br-lan 2025-02-15 22:12:25 +03:00
itdoginfo
9bcc80f2be Checking file uploads 2025-02-15 19:17:59 +03:00
itdoginfo
bfde7518fb Merge pull request #20 from VizzleTF/main
feat(podkop): add show config + version features
2025-02-15 18:21:47 +03:00
Ivan K
18d466e166 feat(podkop): add version display in UI
- Added version display in Podkop UI
- Updated init script to fetch and display version
2025-02-15 17:58:39 +03:00
Ivan K
a30752d2e9 fix(init.d): decode URL-encoded characters in get_param
- Replaced `uhttpd` with `sed` for URL decoding
2025-02-15 17:47:09 +03:00
Ivan K
eb18537370 feat(podkop): add show_version command
- Update init script to include show_version command
- Add show_version function to display current version
- Update EXTRA_COMMANDS to include show_version
- Remove version from web and config
2025-02-15 17:30:14 +03:00
Ivan K
aa86445332 feat(podkop): add show config feature
- Add new button to show config with masked sensitive data
- Update init script with new command `show_config`
- Implement `show_config` function to mask sensitive data
- Update version in config file to 0.3.3
- Update proxy check logic for better error handling
2025-02-15 16:55:51 +03:00
11 changed files with 2591 additions and 647 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
* @itdoginfo

View File

@@ -2,11 +2,13 @@
- Это альфа версия, которая находится в активной разработке. Из версии в версию что-то может меняться.
- Основной функционал работает, но побочные штуки сейчас могут сбоить.
- При обновлении всегда заходите в конфигурацию и проверяйте свои настройки. Конфигурация может измениться.
- При обновлении **обязатально** сбрасывайте кэш LuCI.
- Также при обновлении всегда заходите в конфигурацию и проверяйте свои настройки. Конфигурация может измениться.
- Необходимо минимум 15МБ свободного места на роутере. Роутерами с флешками на 16МБ сразу мимо.
- При старте программы редактируется конфиг Dnsmasq.
- Podkop редактирует конфиг sing-box. Обязательно сохраните ваш конфиг sing-box перед установкой, если он вам нужен.
- Информация здесь может быть устаревшей. Все изменения фиксируются в телеграм-чате https://t.me/itdogchat - топик **Podkop**.
- Если у вас не что-то не работает, то следуюет сходить в телеграм чат, прочитать закрепы и выполнить что там написано..
- Если у вас установлен Getdomains, его следует удалить.
# Удаление GetDomains скриптом
@@ -18,7 +20,8 @@ sh <(wget -O - https://raw.githubusercontent.com/itdoginfo/domain-routing-openwr
# Установка Podkop
Пакет работает на всех архитектурах.
Тестировался на OpenWrt 23.05 и OpenWrt 24.10.
Тестировался на **ванильной** OpenWrt 23.05 и OpenWrt 24.10.
На FriendlyWrt 23.05 присуствуют зависимости от iptables, которые ломают tproxy. Если у вас появляется warning про это в логах, следуйте инструкции по приведённой там ссылке.
Поддержки APK на данный момент нет. APK будет сделан после того как разгребу основное.
@@ -43,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
```
Если был установлен русский язык
@@ -98,6 +101,10 @@ Luci: Services/podkop
list doh_server '127.0.0.1#5053'
list doh_server '127.0.0.1#5054'
```
- [x] Только кастомный remote list не создаёт секцию в route-rules-rule-set и dns-rules-ruleset
- [ ] Не отрабатывает service podkop stop, если podkop запущен и не может, к пример, зарезолвить домен с сломанным DNS
- [ ] Всплывает в логах при старте. Не каждый раз. На работу не влияет. Wed Feb 19 17:12:28 2025 daemon.err sh[17665]: Command failed: ubus call service delete { "name": "sing-box" } (Not found)
# ToDo
Этот раздел не означает задачи, которые нужно брать и делать. Это общий список хотелок. Если вы хотите помочь, пожалуйста, спросите сначала в телеграмме.
@@ -148,6 +155,9 @@ Luci: Services/podkop
- [ ] Диагностика: podkop_domains: 0 elements как проверять что доходят запросы при fakeip? Мб врубать логи dnsmasq и их чекать.
- [ ] Сделать галку запрещающую подкопу редачить dhcp. Допилить в исключение вместе с пустыми полями proxy и vpn
- [ ] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
- [ ] Добавление в список доменов домены первого уровня (LuCI)
- [ ] Проверка, что версия в makefile совпадает с тегом
- [ ] Don't touch my DHCP!
Приоритет 2
- [x] Списки доменов и подсетей с роутера
@@ -174,6 +184,14 @@ Wiki
Хз как сделать
- [ ] Добавить 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)

97
install-v0.2.5.sh Executable file
View 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

View File

@@ -4,24 +4,21 @@ REPO="https://api.github.com/repos/itdoginfo/podkop/releases/latest"
IS_SHOULD_RESTART_NETWORK=
DOWNLOAD_DIR="/tmp/podkop"
COUNT=3
rm -rf "$DOWNLOAD_DIR"
mkdir -p "$DOWNLOAD_DIR"
main() {
check_system
wget -qO- "$REPO" | grep -o 'https://[^"]*\.ipk' | while read -r url; do
filename=$(basename "$url")
echo "Download $filename..."
wget -q -O "$DOWNLOAD_DIR/$filename" "$url"
done
echo "opkg update"
sing_box
opkg update
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;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
read -r -p '' UPDATE
@@ -46,29 +43,66 @@ main() {
add_tunnel
fi
opkg install $DOWNLOAD_DIR/podkop*.ipk
opkg install $DOWNLOAD_DIR/luci-app-podkop*.ipk
echo "Русский язык интерфейса ставим? y/n (Need a Russian translation?)"
while true; do
read -r -p '' RUS
case $RUS in
y)
opkg install $DOWNLOAD_DIR/luci-i18n-podkop-ru*.ipk
break
;;
n)
break
;;
*)
echo "Please enter y or n"
;;
esac
download_success=0
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
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
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk $DOWNLOAD_DIR/luci-i18n-podkop-ru*.ipk
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
find "$DOWNLOAD_DIR" -type f -name '*podkop*' -exec rm {} \;
if [ "$IS_SHOULD_RESTART_NETWORK" ]; then
printf "\033[32;1mRestart network\033[0m\n"
@@ -77,7 +111,7 @@ main() {
}
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 "2) AmneziaWG"
echo "3) OpenVPN"
@@ -129,7 +163,7 @@ add_tunnel() {
;;
5)
echo "Skip. Use this if you're installing an upgrade."
echo "Installation without additional dependencies."
break
;;
@@ -367,18 +401,37 @@ check_system() {
echo "Router model: $MODEL"
# 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
echo "Available space: $((AVAILABLE_SPACE/1024))MB"
echo "Required space: $((REQUIRED_SPACE/1024))MB"
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 "Required: $((REQUIRED_SPACE/1024))MB"
exit 1
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
}
main
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}')
required_version="1.11.1"
if [ "$(echo -e "$sing_box_version\n$required_version" | sort -V | head -n 1)" != "$required_version" ]; then
opkg remove sing-box
fi
}
main

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-podkop
PKG_VERSION:=0.3.3
PKG_VERSION:=0.3.11
PKG_RELEASE:=1
LUCI_TITLE:=LuCI podkop app

View File

@@ -25,44 +25,59 @@ msgstr "Тип подключения"
msgid "Select between VPN and Proxy connection methods for traffic routing"
msgstr "Выберите между VPN и Proxy методами для маршрутизации трафика"
msgid "Configuration Type"
msgstr "Тип конфигурации"
msgid "Select how to configure the proxy"
msgstr "Выберите способ настройки прокси"
msgid "Connection URL"
msgstr "URL подключения"
msgid "Outbound Config"
msgstr "Конфигурация Outbound"
msgid "Proxy Configuration URL"
msgstr "URL конфигурации прокси"
msgid "Enter connection string starting with vless:// or ss:// for proxy configuration"
msgstr "Введите строку подключения, начинающуюся с vless:// или ss:// для настройки прокси"
msgid "Outbound Configuration"
msgstr "Конфигурация исходящего соединения"
msgid "Enter complete outbound configuration in JSON format"
msgstr "Введите полную конфигурацию исходящего соединения в формате JSON"
msgid "Network Interface"
msgstr "Сетевой интерфейс"
msgid "Select network interface for VPN connection"
msgstr "Выберите сетевой интерфейс для VPN подключения"
msgid "Community Domain Lists"
msgstr "Предустановленные списки доменов"
msgid "Community Lists"
msgstr "Предустановленные списки"
msgid "Domain List"
msgstr "Список доменов"
msgid "Service List"
msgstr "Список сервисов"
msgid "Select a list"
msgstr "Выберите список доменов"
msgid "Select predefined service for routing"
msgstr "Выберите предустановленные сервисы для маршрутизации"
msgid "Community Subnet Lists"
msgstr "Предустановленные сети сервисов"
msgid "User Domain List Type"
msgstr "Тип пользовательского списка доменов"
msgid "Enable routing for popular services like Twitter, Meta, and Discord"
msgstr "Включить маршрутизацию для популярных сервисов, таких как Twitter, Meta и Discord"
msgid "Select how to add your custom domains"
msgstr "Выберите способ добавления пользовательских доменов"
msgid "Service Networks"
msgstr "Сети сервисов"
msgid "Disabled"
msgstr "Отключено"
msgid "Select predefined service networks for routing"
msgstr "Выберите предустановленные сети сервисов для маршрутизации"
msgid "Dynamic List"
msgstr "Динамический список"
msgid "User Domain List"
msgstr "Пользовательский список доменов"
msgid "Enable and manage your custom list of domains for selective routing"
msgstr "Включить и управлять пользовательским списком доменов для выборочной маршрутизации"
msgid "Text List"
msgstr "Текстовый список"
msgid "User Domains"
msgstr "Пользовательские домены"
@@ -70,6 +85,24 @@ msgstr "Пользовательские домены"
msgid "Enter domain names without protocols (example: sub.example.com or example.com)"
msgstr "Введите имена доменов без протоколов (пример: sub.example.com или example.com)"
msgid "User Domains List"
msgstr "Список пользовательских доменов"
msgid "Enter domain names separated by comma, space or newline (example: sub.example.com, example.com or one domain per line)"
msgstr "Введите имена доменов через запятую, пробел или новую строку (пример: sub.example.com, example.com или один домен на строку)"
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 "Remote Domain Lists"
msgstr "Удаленные списки доменов"
@@ -82,17 +115,26 @@ msgstr "URL удаленных доменов"
msgid "Enter full URLs starting with http:// or https://"
msgstr "Введите полные URL, начинающиеся с http:// или https://"
msgid "User Subnet List"
msgstr "Пользовательский список подсетей"
msgid "User Subnet List Type"
msgstr "Тип пользовательского списка подсетей"
msgid "Enable and manage your custom list of IP subnets for selective routing"
msgstr "Включить и управлять пользовательским списком IP-подсетей для выборочной маршрутизации"
msgid "Select how to add your custom subnets"
msgstr "Выберите способ добавления пользовательских подсетей"
msgid "Text List (comma/space/newline separated)"
msgstr "Текстовый список (разделенный запятыми/пробелами/новыми строками)"
msgid "User Subnets"
msgstr "Пользовательские подсети"
msgid "Enter subnet in CIDR notation (example: 103.21.244.0/22)"
msgstr "Введите подсеть в нотации CIDR (пример: 103.21.244.0/22)"
msgid "Enter subnets in CIDR notation (example: 103.21.244.0/22) or single IP addresses"
msgstr "Введите подсети в нотации CIDR (пример: 103.21.244.0/22) или отдельные IP-адреса"
msgid "User Subnets List"
msgstr "Список пользовательских подсетей"
msgid "Enter subnets in CIDR notation or single IP addresses, separated by comma, space or newline"
msgstr "Введите подсети в нотации CIDR или отдельные IP-адреса через запятую, пробел или новую строку"
msgid "Remote Subnet Lists"
msgstr "Удаленные списки подсетей"
@@ -103,18 +145,6 @@ msgstr "Загрузка и использование списков подсе
msgid "Remote Subnet URLs"
msgstr "URL удаленных подсетей"
msgid "Domain Exclusions"
msgstr "Исключения доменов"
msgid "Exclude specific domains from routing rules"
msgstr "Исключить определенные домены из правил маршрутизации"
msgid "Excluded Domains"
msgstr "Исключенные домены"
msgid "Domains to be excluded from routing"
msgstr "Домены, которые будут исключены из маршрутизации"
msgid "IP for full redirection"
msgstr "Принудительные прокси IP"
@@ -133,6 +163,27 @@ msgstr "Исключения прокси IP"
msgid "Specify local IP addresses that will never use the configured route"
msgstr "Укажите локальные IP-адреса, которые никогда не будут использовать настроенный маршрут"
msgid "Mixed enable"
msgstr "Включить смешанный режим"
msgid "Browser port: 2080"
msgstr "Порт браузера: 2080"
msgid "Yacd enable"
msgstr "Включить Yacd"
msgid "Exclude NTP"
msgstr "Исключить NTP"
msgid "For issues with open connections sing-box"
msgstr "Для проблем с открытыми соединениями sing-box"
msgid "QUIC disable"
msgstr "Отключить QUIC"
msgid "For issues with the video stream"
msgstr "Для проблем с видеопотоком"
msgid "List Update Frequency"
msgstr "Частота обновления списков"
@@ -145,6 +196,9 @@ msgstr "Каждый час"
msgid "Every 2 hours"
msgstr "Каждые 2 часа"
msgid "Every 3 hours"
msgstr "Каждые 3 часа"
msgid "Every 4 hours"
msgstr "Каждые 4 часа"
@@ -154,51 +208,18 @@ msgstr "Каждые 6 часов"
msgid "Every 12 hours"
msgstr "Каждые 12 часов"
msgid "Every day"
msgstr "Каждый день"
msgid "Every 3 days"
msgstr "Каждые 3 дня"
msgid "Once a day at 04:00"
msgstr "Раз в день в 04:00"
msgid "Once a week on Sunday at 04:00"
msgstr "Раз в неделю в воскресенье в 04:00"
msgid "Yacd enable"
msgstr "Включить Yacd"
msgid "Mixed enable"
msgstr "Включить смешанный режим"
msgid "Browser port: 2080"
msgstr "Порт браузера: 2080"
msgid "Exclude NTP"
msgstr "Исключить NTP"
msgid "For issues with open connections sing-box"
msgstr "Для проблем с открытыми соединениями sing-box"
msgid "Service Domain List Enable"
msgstr "Включить список доменов сервисов"
msgid "Enable predefined service domain lists for routing"
msgstr "Включить предустановленные списки доменов для маршрутизации"
msgid "Service List"
msgstr "Список сервисов"
msgid "Select predefined services for routing"
msgstr "Выберите предустановленные сервисы для маршрутизации"
msgid "Domains"
msgstr "Домены"
msgid "Subnet List"
msgstr "Список подсетей"
msgid "Configure custom subnets for routing"
msgstr "Настройка пользовательских подсетей для маршрутизации"
msgid "Subnets"
msgstr "Подсети"
msgid "Invalid domain format. Enter domain without protocol (example: sub.example.com)"
msgstr "Неверный формат домена. Введите домен без протокола (пример: sub.example.com)"
@@ -208,8 +229,8 @@ msgstr "URL должен использовать протокол http:// ил
msgid "Invalid URL format. URL must start with http:// or https://"
msgstr "Неверный формат URL. URL должен начинаться с http:// или https://"
msgid "Invalid subnet format. Use format: X.X.X.X/Y (like 192.168.1.0/24)"
msgstr "Неверный формат подсети. Используйте формат: X.X.X.X/Y (например: 192.168.1.0/24)"
msgid "Invalid format. Use format: X.X.X.X or X.X.X.X/Y"
msgstr "Неверный формат. Используйте формат: X.X.X.X или X.X.X.X/Y"
msgid "IP address parts must be between 0 and 255"
msgstr "Части IP-адреса должны быть между 0 и 255"
@@ -220,71 +241,23 @@ msgstr "CIDR должен быть между 0 и 32"
msgid "Invalid IP format. Use format: X.X.X.X (like 192.168.1.1)"
msgstr "Неверный формат IP. Используйте формат: X.X.X.X (например: 192.168.1.1)"
msgid "User Domain List Type"
msgstr "Тип пользовательского списка доменов"
msgid "Select how to add your custom domains"
msgstr "Выберите способ добавления пользовательских доменов"
msgid "Disabled"
msgstr "Отключено"
msgid "Dynamic List"
msgstr "Динамический список"
msgid "Text List"
msgstr "Текстовый список"
msgid "User Domains List"
msgstr "Список пользовательских доменов"
msgid "Enter domain names separated by comma, space or newline (example: sub.example.com, example.com or one domain per line)"
msgstr "Введите имена доменов через запятую, пробел или новую строку (пример: sub.example.com, example.com или один домен на строку)"
msgid "Invalid domain format: %s. Enter domain without protocol"
msgstr "Неверный формат домена: %s. Введите домен без протокола"
msgid "User Subnet List Type"
msgstr "Тип пользовательского списка подсетей"
msgid "Select how to add your custom subnets"
msgstr "Выберите способ добавления пользовательских подсетей"
msgid "Text List (comma/space/newline separated)"
msgstr "Текстовый список (разделенный запятыми/пробелами/новыми строками)"
msgid "Enter subnets in CIDR notation (example: 103.21.244.0/22) or single IP addresses"
msgstr "Введите подсети в нотации CIDR (пример: 103.21.244.0/22) или отдельные IP-адреса"
msgid "User Subnets List"
msgstr "Список пользовательских подсетей"
msgid "Enter subnets in CIDR notation or single IP addresses, separated by comma, space or newline"
msgstr "Введите подсети в нотации CIDR или отдельные IP-адреса через запятую, пробел или новую строку"
msgid "Invalid format. Use format: X.X.X.X or X.X.X.X/Y"
msgstr "Неверный формат. Используйте формат: X.X.X.X или X.X.X.X/Y"
msgid "Invalid format: %s. Use format: X.X.X.X or X.X.X.X/Y"
msgstr "Неверный формат: %s. Используйте формат: X.X.X.X или X.X.X.X/Y"
msgid "IP parts must be between 0 and 255 in: %s"
msgstr "Части IP-адреса должны быть между 0 и 255 в: %s"
msgid "Configuration Type"
msgstr "Тип конфигурации"
msgid "CIDR must be between 0 and 32 in: %s"
msgstr "CIDR должен быть между 0 и 32 в: %s"
msgid "Select how to configure the proxy"
msgstr "Выберите способ настройки прокси"
msgid "Invalid path format. Path must start with \"/\" and contain only valid characters (letters, numbers, \"-\", \"_\", \"/\", \".\")"
msgstr "Неверный формат пути. Путь должен начинаться с \"/\" и содержать только допустимые символы (буквы, цифры, \"-\", \"_\", \"/\", \".\")"
msgid "Connection URL"
msgstr "URL подключения"
msgid "Outbound Config"
msgstr "Конфигурация Outbound"
msgid "Outbound Configuration"
msgstr "Конфигурация исходящего соединения"
msgid "Enter complete outbound configuration in JSON format"
msgstr "Введите полную конфигурацию исходящего соединения в формате JSON"
msgid "Invalid path format"
msgstr "Неверный формат пути"
msgid "JSON must contain at least type, server and server_port fields"
msgstr "JSON должен содержать как минимум поля type, server и server_port"
@@ -292,41 +265,233 @@ msgstr "JSON должен содержать как минимум поля type
msgid "Invalid JSON format"
msgstr "Неверный формат JSON"
msgid "Diagnostics"
msgstr "Диагностика"
msgid "Warning: %s cannot be used together with %s. Previous selections have been removed."
msgstr "Предупреждение: %s нельзя использовать вместе с %s. Предыдущие варианты были удалены."
msgid "Main Check"
msgstr "Основная проверка"
msgid "Regional options cannot be used together"
msgstr "Нельзя использовать несколько региональных опций"
msgid "Run a comprehensive diagnostic check of all components"
msgstr "Запустить комплексную диагностическую проверку всех компонентов"
msgid "Warning: Russia inside can only be used with Meta, Twitter, Discord, and Telegram. %s already in Russia inside and have been removed from selection."
msgstr "Внимание: Russia inside может использоваться только с Meta, Twitter, Discord и Telegram. %s были удалены из выбора."
msgid "Run Check"
msgstr "Запустить проверку"
msgid "Russia inside restrictions"
msgstr "Ограничения Russia inside"
msgid "Full Diagnostic Results"
msgstr "Полные результаты диагностики"
msgid "URL must start with vless:// or ss://"
msgstr "URL должен начинаться с vless:// или ss://"
msgid "Failed to copy: "
msgstr "Ошибка копирования: "
msgid "Invalid Shadowsocks URL format: missing method and password separator \":\""
msgstr "Неверный формат URL Shadowsocks: отсутствует разделитель метода и пароля \":\""
msgid "Copy to Clipboard"
msgstr "Скопировать в буфер"
msgid "Invalid Shadowsocks URL format"
msgstr "Неверный формат URL Shadowsocks"
msgid "Close"
msgstr "Закрыть"
msgid "Invalid Shadowsocks URL: missing server address"
msgstr "Неверный URL Shadowsocks: отсутствует адрес сервера"
msgid "No output"
msgstr "Нет данных"
msgid "Invalid Shadowsocks URL: missing server"
msgstr "Неверный URL Shadowsocks: отсутствует сервер"
msgid "System Logs"
msgstr "Системные логи"
msgid "Invalid Shadowsocks URL: missing port"
msgstr "Неверный URL Shadowsocks: отсутствует порт"
msgid "View recent system logs related to Podkop"
msgstr "Просмотр недавних системных логов, связанных с Podkop"
msgid "Invalid port number. Must be between 1 and 65535"
msgstr "Неверный номер порта. Должен быть между 1 и 65535"
msgid "View Logs"
msgstr "Просмотр логов"
msgid "Invalid Shadowsocks URL: missing or invalid server/port format"
msgstr "Неверный URL Shadowsocks: отсутствует или неверный формат сервера/порта"
msgid "Failed to copy logs: "
msgstr "Ошибка копирования логов: "
msgid "Invalid VLESS URL: missing UUID"
msgstr "Неверный URL VLESS: отсутствует UUID"
msgid "Invalid VLESS URL: missing server address"
msgstr "Неверный URL VLESS: отсутствует адрес сервера"
msgid "Invalid VLESS URL: missing server"
msgstr "Неверный URL VLESS: отсутствует сервер"
msgid "Invalid VLESS URL: missing port"
msgstr "Неверный URL VLESS: отсутствует порт"
msgid "Invalid VLESS URL: missing or invalid server/port format"
msgstr "Неверный URL VLESS: отсутствует или неверный формат сервера/порта"
msgid "Invalid VLESS URL: missing query parameters"
msgstr "Неверный URL VLESS: отсутствуют параметры запроса"
msgid "Invalid VLESS URL: missing type parameter"
msgstr "Неверный URL VLESS: отсутствует параметр type"
msgid "Invalid VLESS URL: missing security parameter"
msgstr "Неверный URL VLESS: отсутствует параметр security"
msgid "Invalid VLESS URL: missing pbk parameter for reality security"
msgstr "Неверный URL VLESS: отсутствует параметр pbk для security reality"
msgid "Invalid VLESS URL: missing fp parameter for reality security"
msgstr "Неверный URL VLESS: отсутствует параметр fp для security reality"
msgid "Invalid VLESS URL: missing sni parameter for tls security"
msgstr "Неверный URL VLESS: отсутствует параметр sni для security tls"
msgid "Invalid URL format: %s"
msgstr "Неверный формат URL: %s"
msgid "Remote Domain Lists URL"
msgstr "URL удаленных списков доменов"
msgid "Enter URL to download domain list"
msgstr "Введите URL для загрузки списка доменов"
msgid "Update Interval"
msgstr "Интервал обновления"
msgid "Select how often to update the lists"
msgstr "Выберите, как часто обновлять списки"
msgid "Last Update"
msgstr "Последнее обновление"
msgid "Last update time"
msgstr "Время последнего обновления"
msgid "Next Update"
msgstr "Следующее обновление"
msgid "Next scheduled update time"
msgstr "Время следующего запланированного обновления"
msgid "Version"
msgstr "Версия"
msgid "Component version"
msgstr "Версия компонента"
msgid "Installed"
msgstr "Установлено"
msgid "Not installed"
msgstr "Не установлено"
msgid "Unknown version"
msgstr "Неизвестная версия"
msgid "Error parsing version"
msgstr "Ошибка разбора версии"
msgid "Error parsing status"
msgstr "Ошибка разбора статуса"
msgid "Service is running"
msgstr "Сервис запущен"
msgid "Service is stopped"
msgstr "Сервис остановлен"
msgid "Service is enabled"
msgstr "Сервис включен"
msgid "Service is disabled"
msgstr "Сервис отключен"
msgid "Service Status"
msgstr "Статус сервиса"
msgid "working"
msgstr "работает"
msgid "not working"
msgstr "не работает"
msgid "check error"
msgstr "ошибка проверки"
msgid "Diagnostic check in progress..."
msgstr "Выполняется диагностическая проверка..."
msgid "Diagnostic check completed"
msgstr "Диагностическая проверка завершена"
msgid "Diagnostic check failed"
msgstr "Диагностическая проверка не удалась"
msgid "Update in progress..."
msgstr "Выполняется обновление..."
msgid "Update completed"
msgstr "Обновление завершено"
msgid "Update failed"
msgstr "Обновление не удалось"
msgid "Check in progress..."
msgstr "Выполняется проверка..."
msgid "Check completed"
msgstr "Проверка завершена"
msgid "Check failed"
msgstr "Проверка не удалась"
msgid "Version Information"
msgstr "Информация о версии"
msgid "Copied!"
msgstr "Скопировано!"
msgid "Podkop Status"
msgstr "Статус Podkop"
msgid "Start Podkop"
msgstr "Запустить Podkop"
msgid "Stop Podkop"
msgstr "Остановить Podkop"
msgid "Restart Podkop"
msgstr "Перезапустить Podkop"
msgid "Enable Podkop"
msgstr "Включить Podkop"
msgid "Disable Podkop"
msgstr "Отключить Podkop"
msgid "Loading diagnostics..."
msgstr "Загрузка диагностики..."
msgid "Error loading diagnostics"
msgstr "Ошибка загрузки диагностики"
msgid "Sing-box Status"
msgstr "Статус Sing-box"
msgid "Diagnostic Tools"
msgstr "Инструменты диагностики"
msgid "Unknown"
msgstr "Неизвестно"
msgid "Device Model: "
msgstr "Модель устройства: "
msgid "OpenWrt Version: "
msgstr "Версия OpenWrt: "
msgid "Sing-box: "
msgstr "Sing-box: "
msgid "LuCI App: "
msgstr "LuCI App: "
msgid "Podkop: "
msgstr "Podkop: "
msgid "Check NFT Rules"
msgstr "Проверить правила NFT"
msgid "Update Lists"
msgstr "Обновить списки"
msgid "Lists Update Results"
msgstr "Результаты обновления списков"

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=podkop
PKG_VERSION:=0.3.3
PKG_VERSION:=0.3.11
PKG_RELEASE:=1
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
/etc/init.d/podkop stop
exit 0
endef

View File

@@ -28,5 +28,7 @@ config main 'main'
option yacd '0'
option socks5 '0'
option exclude_ntp '0'
option quic_disable '0'
option dont_touch_dhcp '0'
option update_interval '1d'
option custom_domains_text

View File

@@ -7,16 +7,22 @@ script=$(readlink "$initscript")
NAME="$(basename ${script:-$initscript})"
config_load "$NAME"
EXTRA_COMMANDS="list_update check_proxy check_nft check_github check_logs check_all check_three main"
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 show_luci_version show_sing_box_version show_system_info get_status get_sing_box_status"
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_nft Show PodkopTable nftables rules
check_github Check GitHub connectivity and lists availability
check_logs Show podkop logs from system journal
check_all Run all checks
check_three Run check_proxy, check_nft and check_github
main Main function"
check_sing_box_connections Show active sing-box network connections
check_sing_box_logs Show recent sing-box logs
check_dnsmasq Show current DNSMasq configuration
show_config Show current configuration with masked sensitive data
show_version Show current version
show_sing_box_config Show current sing-box configuration
show_luci_version Show LuCI app version
show_sing_box_version Show sing-box version
show_system_info Show OpenWrt version and device model
get_sing_box_status Get sing-box status"
[ ! -L /usr/sbin/podkop ] && ln -s /etc/init.d/podkop /usr/sbin/podkop
@@ -33,10 +39,32 @@ SUBNETS_TELERAM="${GITHUB_RAW_URL}/Subnets/IPv4/telegram.lst"
SING_BOX_CONFIG="/etc/sing-box/config.json"
CACHE_FILE_PATH="/tmp/cache.db"
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() {
log "Start podkop"
sing_box_version=$(sing-box version | head -n 1 | awk '{print $3}')
required_version="1.11.1"
if [ "$(echo -e "$sing_box_version\n$required_version" | sort -V | head -n 1)" != "$required_version" ]; then
echo "The version of sing-box ($sing_box_version) is lower than the minimum version. Update sing-box: opkg update && opkg remove sing-box && opkg install sing-box"
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
if ! ip addr | grep -q "br-lan"; then
log "Interface br-lan not found"
exit 1
fi
migration
config_foreach process_validate_service
procd_open_instance
procd_set_param command /bin/sh -c "/etc/init.d/podkop main &"
procd_set_param stdout 1
@@ -47,9 +75,13 @@ start_service() {
stop_service() {
log "Stopping the podkop"
remove_cron_job
dnsmasq_rm
rm -rf /tmp/podkop/*
config_get_bool dont_touch_dhcp "main" "dont_touch_dhcp" "0"
if [ "$dont_touch_dhcp" -eq 0 ]; then
dnsmasq_restore
fi
rm -rf /tmp/podkop/*.lst
log "Flush nft"
if nft list table inet PodkopTable >/dev/null 2>&1; then
@@ -109,22 +141,12 @@ nolog() {
}
main() {
sing_box_version=$(sing-box version | head -n 1 | awk '{print $3}')
required_version="1.11.1"
if [ "$(echo -e "$sing_box_version\n$required_version" | sort -V | head -n 1)" != "$required_version" ]; then
echo "The version of sing-box ($sing_box_version) is lower than the minimum version. Update sing-box: opkg update && opkg install sing-box"
exit 1
fi
migration
sleep 5
config_foreach wget_github
mkdir -p /tmp/podkop
# base
route_table_rule_mark
create_nft_table
@@ -135,6 +157,7 @@ main() {
sing_box_dns
sing_box_dns_rule_fakeip
sing_box_rule_dns
sing_box_add_secure_dns_probe_domain
sing_box_cache_file
process_socks5
@@ -172,6 +195,12 @@ main() {
nft insert rule inet PodkopTable mangle udp dport 123 return
fi
config_get_bool quic_disable "main" "quic_disable" "0"
if [ "$quic_disable" -eq 1 ]; then
log "Rule for disable QUIC"
sing_box_quic_reject
fi
sing_box_config_check
/etc/init.d/sing-box restart
/etc/init.d/sing-box enable
@@ -180,22 +209,82 @@ main() {
config_get interface "main" "interface"
if [ -n "$proxy_string" ] || [ -n "$interface" ]; then
dnsmasq_add
config_get_bool dont_touch_dhcp "main" "dont_touch_dhcp" "0"
if [ "$dont_touch_dhcp" -eq 0 ]; then
dnsmasq_add_resolver
fi
fi
}
# Migrations funcs
# Migrations and validation funcs
migration() {
# list migrate
grep -q "list domain_list 'ru_inside'" /etc/config/podkop && sed -i "s/list domain_list 'ru_inside'/list domain_list 'russia_inside'/" /etc/config/podkop
grep -q "list domain_list 'ru_outside'" /etc/config/podkop && sed -i "s/list domain_list 'ru_outside'/list domain_list 'russia_outside'/" /etc/config/podkop
grep -q "list domain_list 'ua'" /etc/config/podkop && sed -i "s/list domain_list 'ua'/list domain_list 'ukraine_inside'/" /etc/config/podkop
local CONFIG="/etc/config/podkop"
if grep -q "ru_inside" $CONFIG; then
log "Depricated list found: ru_inside"
sed -i '/ru_inside/d' $CONFIG
fi
if grep -q "list domain_list 'ru_outside'" $CONFIG; then
log "Depricated list found: sru_outside"
sed -i '/ru_outside/d' $CONFIG
fi
if grep -q "list domain_list 'ua'" $CONFIG; then
log "Depricated list found: ua"
sed -i '/ua/d' $CONFIG
fi
# Subnet list
if grep -q "list subnets" $CONFIG; then
log "Depricated second section found"
sed -i '/list subnets/d' $CONFIG
fi
# second remove
grep -q "config second 'second'" /etc/config/podkop && sed -i '/second/d' /etc/config/podkop
if grep -q "config second 'second'" $CONFIG; then
log "Depricated second section found"
sed -i '/second/d' $CONFIG
fi
# cron update
grep -qE "^\s*option update_interval '[0-9*/,-]+( [0-9*/,-]+){4}'" /etc/config/podkop && sed -i "s|^\(\s*option update_interval\) '[0-9*/,-]\+\( [0-9*/,-]\+\)\{4\}'|\1 '1d'|" /etc/config/podkop
if grep -qE "^\s*option update_interval '[0-9*/,-]+( [0-9*/,-]+){4}'" $CONFIG; then
log "Depricated update_interval"
sed -i "s|^\(\s*option update_interval\) '[0-9*/,-]\+\( [0-9*/,-]\+\)\{4\}'|\1 '1d'|" $CONFIG
fi
# dnsmasq https
if grep -q "^filter-rr=HTTPS" "/etc/dnsmasq.conf"; then
log "Found and removed filter-rr=HTTPS in dnsmasq config"
sed -i '/^filter-rr=HTTPS/d' "/etc/dnsmasq.conf"
fi
# dhcp use-application-dns.net
if grep -q "use-application-dns.net" "/etc/config/dhcp"; then
log "Found and removed use-application-dns.net in dhcp config"
sed -i '/use-application-dns/d' "/etc/config/dhcp"
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
@@ -239,31 +328,72 @@ create_nft_table() {
nft add rule inet $table proxy meta mark 0x105 meta l4proto udp tproxy ip to :1602 counter
}
dnsmasq_add() {
## Future: Check config and skip restart
save_dnsmasq_config() {
local key="$1"
local backup_key="$2"
value=$(uci get "$key" 2>/dev/null)
if [ -z "$value" ]; then
uci -q delete "$backup_key"
else
uci set "$backup_key"="$value"
fi
}
dnsmasq_add_resolver() {
log "Save dnsmasq config"
save_dnsmasq_config "dhcp.@dnsmasq[0].noresolv" "dhcp.@dnsmasq[0].podkop_noresolv"
save_dnsmasq_config "dhcp.@dnsmasq[0].cachesize" "dhcp.@dnsmasq[0].podkop_cachesize"
uci -q delete dhcp.@dnsmasq[0].podkop_server
for server in $(uci get dhcp.@dnsmasq[0].server 2>/dev/null); do
if [[ "$server" == "127.0.0.42" ]]; then
log "Dnsmasq save config error: server=127.0.0.42"
else
uci add_list dhcp.@dnsmasq[0].podkop_server="$server"
fi
done
log "Configure dnsmasq for sing-box"
uci set dhcp.@dnsmasq[0].noresolv="1"
uci set dhcp.@dnsmasq[0].filter_aaaa="1"
uci set dhcp.@dnsmasq[0].cachesize="0"
uci -q delete dhcp.@dnsmasq[0].server
uci add_list dhcp.@dnsmasq[0].server="127.0.0.1#5353"
uci add_list dhcp.@dnsmasq[0].server='/use-application-dns.net/'
uci add_list dhcp.@dnsmasq[0].server="127.0.0.42"
uci commit dhcp
grep -q "filter-rr=HTTPS" /etc/dnsmasq.conf || echo "filter-rr=HTTPS" >> /etc/dnsmasq.conf
/etc/init.d/dnsmasq restart
}
dnsmasq_rm() {
dnsmasq_restore() {
log "Removing configuration for dnsmasq"
uci set dhcp.@dnsmasq[0].noresolv="0"
uci set dhcp.@dnsmasq[0].filter_aaaa="0"
uci set dhcp.@dnsmasq[0].cachesize="1000"
uci -q delete dhcp.@dnsmasq[0].server
uci commit dhcp
sed -i '/filter-rr=HTTPS/d' /etc/dnsmasq.conf
local cachesize=$(uci get dhcp.@dnsmasq[0].podkop_cachesize 2>/dev/null)
if [ -z "$cachesize" ]; then
log "dnsmasq revert: cachesize is unset"
else
uci set dhcp.@dnsmasq[0].cachesize="$cachesize"
fi
local noresolv=$(uci get dhcp.@dnsmasq[0].podkop_noresolv 2>/dev/null)
if [ -z "$noresolv" ]; then
log "dnsmasq revert: noresolv is unset"
else
uci set dhcp.@dnsmasq[0].noresolv="$noresolv"
fi
local server=$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)
if [[ "$server" == "127.0.0.42" ]]; then
uci -q delete dhcp.@dnsmasq[0].server
for server in $(uci get dhcp.@dnsmasq[0].podkop_server 2>/dev/null); do
uci add_list dhcp.@dnsmasq[0].server="$server"
done
uci delete dhcp.@dnsmasq[0].podkop_server
fi
uci delete dhcp.@dnsmasq[0].podkop_cachesize
uci delete dhcp.@dnsmasq[0].podkop_noresolv
uci commit dhcp
/etc/init.d/dnsmasq restart
}
@@ -478,8 +608,8 @@ sing_box_inbound_proxy() {
{
"tag": "dns-in",
"type": "direct",
"listen": "127.0.0.1",
"listen_port": 5353
"listen": "127.0.0.42",
"listen_port": 53
}
],
"outbounds": [
@@ -520,6 +650,18 @@ sing_box_dns_rule_fakeip() {
jq \
'.dns += {
"rules": [
{
"query_type": [
"HTTPS"
],
"action": "reject"
},
{
"domain_suffix": [
"use-application-dns.net"
],
"action": "reject"
},
{
"server": "fakeip-server",
"rule_set": []
@@ -680,8 +822,8 @@ sing_box_config_outbound_json() {
{
"tag": "dns-in",
"type": "direct",
"listen": "127.0.0.1",
"listen_port": 5353
"listen": "127.0.0.42",
"listen_port": 53
}
],
"outbounds": [],
@@ -1081,7 +1223,7 @@ sing_box_rules() {
local rule_set="$1"
local outbound="$2"
# Check if there is an outbound rule for tproxy-in
# Check if there is an outbound rule for "tproxy-in"
local rule_exists=$(jq -r '.route.rules[] | select(.outbound == "'"$outbound"'" and .inbound == ["tproxy-in"])' "$SING_BOX_CONFIG")
if [[ -n "$rule_exists" ]]; then
@@ -1105,6 +1247,25 @@ sing_box_rules() {
fi
}
sing_box_quic_reject() {
local quic_rule_exists=$(jq -e '.route.rules[] | select(.protocol == "quic" and .action == "reject")' "$SING_BOX_CONFIG")
if [[ -z "$quic_rule_exists" ]]; then
jq '
.route.rules |= (
reduce .[] as $rule ([];
if $rule.protocol == "dns" and $rule.action == "hijack-dns" then
. + [$rule, {"protocol": "quic", "action": "reject"}]
else
. + [$rule]
end
)
)' "$SING_BOX_CONFIG" >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json "$SING_BOX_CONFIG"
log "QUIC reject rule added successfully"
fi
}
process_remote_ruleset() {
config_get_bool domain_list_enabled "$section" "domain_list_enabled" "0"
if [ "$domain_list_enabled" -eq 1 ]; then
@@ -1117,8 +1278,11 @@ process_remote_ruleset() {
sing_box_rule_preset() {
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_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_dns_rule_fakeip_section "$section" "$section"
fi
@@ -1297,30 +1461,57 @@ check_proxy() {
fi
jq '
walk(
if type == "object" then
with_entries(
if [.key] | inside(["uuid", "server", "server_name", "password", "public_key", "short_id"]) then
.value = "MASKED"
else . end
)
else . end
)' $SING_BOX_CONFIG
walk(
if type == "object" then
with_entries(
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"
else . end
)
else . end
)' $SING_BOX_CONFIG
nolog "Checking proxy connection..."
for attempt in `seq 1 5`; do
response=$(sing-box tools fetch ifconfig.me -D /etc/sing-box 2>/dev/null)
if ! echo "$response" | grep -q "403 Forbidden"; then
nolog "Proxy check completed successfully"
#echo "$response" | sed 's/\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)/XXX.\2.\3.\4/'
echo "$response" | sed -n 's/^[0-9]\+\.[0-9]\+\.[0-9]\+\.\([0-9]\+\)$/X.X.X.\1/p'
return 0
fi
done
nolog "Failed to get a non-403 response after 5 attempts"
return 1
for attempt in `seq 1 5`; do
response=$(sing-box tools fetch ifconfig.me -D /etc/sing-box 2>/dev/null)
if echo "$response" | grep -q "^<html\|403 Forbidden"; then
continue
fi
if [[ $response =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
ip=$(echo "$response" | sed -n 's/^[0-9]\+\.[0-9]\+\.[0-9]\+\.\([0-9]\+\)$/X.X.X.\1/p')
nolog "$ip - should match proxy IP"
return 0
elif echo "$response" | grep -q "^[0-9a-fA-F:]*::[0-9a-fA-F:]*$\|^[0-9a-fA-F:]\+$"; then
ip=$(echo "$response" | sed 's/\([0-9a-fA-F]\+:[0-9a-fA-F]\+:[0-9a-fA-F]\+\):.*/\1:XXXX:XXXX:XXXX/')
nolog "$ip - should match proxy IP"
return 0
fi
if [ $attempt -eq 5 ]; then
nolog "Failed to get valid IP address after 5 attempts"
if [ -z "$response" ]; then
nolog "Error: Empty response"
else
nolog "Error response: $response"
fi
return 1
fi
done
}
check_nft() {
@@ -1331,24 +1522,18 @@ check_nft() {
nolog "Checking PodkopTable rules..."
# Список всех возможных сетов
local sets="podkop_domains podkop_subnets podkop_subnets_discord localv4"
nolog "Sets statistics:"
for set_name in $sets; do
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
done
# Check if table exists
if ! nft list table inet PodkopTable >/dev/null 2>&1; then
nolog "PodkopTable not found"
return 1
fi
# Показываем правила с счетчиками
nolog "Current chains and rules:"
nft list table inet PodkopTable | grep "chain\|counter"
# Get all sets
nolog "\nSets configuration:"
nolog "NFT check completed"
nft list table inet PodkopTable
nolog "\nNFT check completed"
}
check_github() {
@@ -1373,36 +1558,244 @@ check_github() {
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() {
nolog "Showing podkop logs from system journal..."
if command -v logread >/dev/null 2>&1; then
# Попытка получить последние 50 записей
logread -e "podkop" | tail -n 50
logread -e podkop | tail -n 50
else
nolog "Error: logread command not found"
return 1
fi
}
check_three() {
nolog "\n=== Checking GitHub connectivity ==="
check_github
show_sing_box_config() {
nolog "Current sing-box configuration:"
nolog "\n=== Checking proxy settings ==="
check_proxy
nolog "\n=== Checking NFT rules ==="
check_nft
nolog "\nFull diagnostic check completed"
if [ ! -f "$SING_BOX_CONFIG" ]; then
nolog "Configuration file not found"
return 1
fi
jq '
walk(
if type == "object" then
with_entries(
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"
else . end
)
else . end
)' "$SING_BOX_CONFIG"
}
check_all() {
nolog "Starting full diagnostic check..."
show_config() {
nolog "Current podkop configuration:"
nolog "\n=== Checking recent logs ==="
check_logs
if [ ! -f /etc/config/podkop ]; then
nolog "Configuration file not found"
return 1
fi
check_three
tmp_config=$(mktemp)
cat /etc/config/podkop | sed \
-e 's/\(option proxy_string\).*/\1 '\''MASKED'\''/g' \
-e 's/\(option outbound_json\).*/\1 '\''MASKED'\''/g' \
-e 's/\(option second_proxy_string\).*/\1 '\''MASKED'\''/g' \
-e 's/\(option second_outbound_json\).*/\1 '\''MASKED'\''/g' \
-e 's/\(vless:\/\/[^@]*@\)/vless:\/\/MASKED@/g' \
-e 's/\(ss:\/\/[^@]*@\)/ss:\/\/MASKED@/g' \
-e 's/\(pbk=[^&]*\)/pbk=MASKED/g' \
-e 's/\(sid=[^&]*\)/sid=MASKED/g' \
> "$tmp_config"
cat "$tmp_config"
rm -f "$tmp_config"
}
show_version() {
local version=$(opkg info podkop | grep -m 1 "Version:" | cut -d' ' -f2)
echo "$version"
}
show_luci_version() {
local version=$(opkg info luci-app-podkop | grep -m 1 "Version:" | cut -d' ' -f2)
echo "$version"
}
show_sing_box_version() {
local version=$(opkg info sing-box | grep -m 1 "Version:" | cut -d' ' -f2)
echo "$version"
}
show_system_info() {
echo "=== OpenWrt Version ==="
grep OPENWRT_RELEASE /etc/os-release | cut -d'"' -f2
echo
echo "=== Device Model ==="
cat /tmp/sysinfo/model
}
get_sing_box_status() {
local running=0
local enabled=0
local status=""
local version=""
# Check if service is enabled
if [ -x /etc/rc.d/S99sing-box ]; then
enabled=1
fi
# Check if service is running
if pgrep -f "sing-box" >/dev/null; then
running=1
version=$(sing-box version | head -n 1 | awk '{print $3}')
fi
# Format status message
if [ $running -eq 1 ]; then
if [ $enabled -eq 1 ]; then
status="running & enabled"
else
status="running but disabled"
fi
else
if [ $enabled -eq 1 ]; then
status="stopped but enabled"
else
status="stopped & disabled"
fi
fi
echo "{\"running\":$running,\"enabled\":$enabled,\"status\":\"$status\"}"
}
get_status() {
local running=0
local enabled=0
local status=""
# Check if service is enabled
if [ -x /etc/rc.d/S99podkop ]; then
enabled=1
fi
# Check if service is running
if pgrep -f "sing-box" >/dev/null; then
running=1
fi
# Format status message
if [ $running -eq 1 ]; then
if [ $enabled -eq 1 ]; then
status="running & enabled"
else
status="running but disabled"
fi
else
if [ $enabled -eq 1 ]; then
status="stopped but enabled"
else
status="stopped & disabled"
fi
fi
echo "{\"running\":$running,\"enabled\":$enabled,\"status\":\"$status\"}"
}
sing_box_add_secure_dns_probe_domain() {
local domain="httpbin.org"
local override_address="numbersapi.com"
if [ -z "$override_address" ]; then
log "Error: Could not get br-lan IP address"
return 1
fi
log "Adding DNS probe domain ${domain} to fakeip-server configuration"
jq \
--arg domain "$domain" \
--arg override "$override_address" \
'.dns.rules |= map(
if .server == "fakeip-server" then
{
"server": .server,
"domain": $domain,
"rule_set": .rule_set
}
else
.
end
) |
.route.rules |= . + [
{
"domain": $domain,
"action": "route-options",
"override_address": $override
}
]' "$SING_BOX_CONFIG" >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json "$SING_BOX_CONFIG"
log "DNS probe domain ${domain} configured with override to ${override_address}"
}