Compare commits

...

16 Commits

Author SHA1 Message Date
itdoginfo
ec3a281cef v0.3.13 2025-02-20 17:22:15 +03:00
itdoginfo
86947e7dee Fix dns_server value 2025-02-20 17:22:03 +03:00
itdoginfo
ff5d017acc Update and rm install 0.2.5 2025-02-20 16:50:06 +03:00
itdoginfo
22d919657c Merge remote-tracking branch 'origin/main' 2025-02-20 16:48:20 +03:00
itdoginfo
3271f23ae0 Fix noresolv bakup 2025-02-20 16:45:22 +03:00
itdoginfo
35ea1a14cf Merge pull request #33 from vernette/feature/dns-server-selection
feat(podkop): add DNS server and protocol selection options
2025-02-20 16:39:05 +03:00
unknown
51a9cc5934 feat(podkop.po): add translations for DNS server address validation messages 2025-02-20 16:34:55 +03:00
unknown
e1df26e62b feat(podkop.js): add DNS server validation for IP and domain formats 2025-02-20 16:33:23 +03:00
unknown
75b8bef0e0 fix(podkop.js): update DNS protocol type and server labels to use translation function 2025-02-20 16:07:38 +03:00
unknown
1a6b0cac46 chore(init.d/podkop): remove redundant comments 2025-02-20 16:03:15 +03:00
unknown
e49bd91109 feat(podkop.po): add translations for DNS protocol and server options 2025-02-20 16:01:23 +03:00
unknown
85642a2585 feat(podkop.pot): add new DNS protocol and server options for translation 2025-02-20 16:01:12 +03:00
unknown
c31785d20e feat(init.d/podkop): add DNS resolver discovery and dynamic configuration 2025-02-20 15:57:52 +03:00
unknown
a0af04037a feat(podkop.js): add DNS protocol type and server options to configuration 2025-02-20 15:57:18 +03:00
itdoginfo
51fb10e30e fix 2025-02-20 00:43:39 +03:00
itdoginfo
069ea41ef8 Hide don't touch my dhcp 2025-02-20 00:25:24 +03:00
8 changed files with 185 additions and 138 deletions

View File

@@ -90,8 +90,6 @@ Luci: Services/podkop
- [x] Выкл-вкл wg через luci не отрабатывает поднятие маршрута
- [ ] Если eof после последней строки в rt_tables, то скрипт не добавляет перенос строки
- [ ] Парсинг VLESS не отрабатывает, если в SNI два домена. Пример `sni=telegram.org%3Bwww.telegram.org`
- [ ] `service network restart` ломает маршруты при sing-box
- [ ] Совпадение секции с ruleset ломает конфиг sing-box
- [ ] В каких-то случаях плохо отрабатывает localfile
- [ ] exit 1 если в конфиге присуствует
```
@@ -145,7 +143,7 @@ Luci: Services/podkop
3) включен, версия 1 (старые релизы xray, sing-box на сервере)
Проблема в том, что это нужно только если SS. Выставлять выбор при парсинг из конфига вопрос можно ли. Если совсем тупо - сделать костыль в допонительные настройки
- [x] Проверка места в скрипте install. Если доступно меньше 20MB - exit 1 c выводом колько надо и сколько доступно. + показ модели роутера
- [ ] Правило запрещающее QUIC
- [x] Правило запрещающее QUIC
- [ ] Проверить обновление списков, отрабатывает ли
- [ ] Проверка на ванильную openwrt
- [ ] Проверка откуда установлен sing-box. Например, проверять установлен ли он из официального репозитория
@@ -154,14 +152,13 @@ Luci: Services/podkop
- [ ] Диагностика: Proxy check completed successfully предположительно не показывает IP, если вернулся это IPv6.
- [ ] Диагностика: podkop_domains: 0 elements как проверять что доходят запросы при fakeip? Мб врубать логи dnsmasq и их чекать.
- [ ] Сделать галку запрещающую подкопу редачить dhcp. Допилить в исключение вместе с пустыми полями proxy и vpn
- [ ] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
- [x] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
- [ ] Добавление в список доменов домены первого уровня (LuCI)
- [ ] Проверка, что версия в makefile совпадает с тегом
- [ ] Don't touch my DHCP!
Приоритет 2
- [x] Списки доменов и подсетей с роутера
- [ ] Кнопка обновления списка доменов и подсетей. Запихнуть в главное меню
- [x] Кнопка обновления списка доменов и подсетей. Запихнуть в главное меню
- [ ] IPv6
Wiki
@@ -184,14 +181,6 @@ 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)

View File

@@ -1,97 +0,0 @@
#!/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

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

View File

@@ -628,10 +628,10 @@ return view.extend({
o.rmempty = false;
o.ucisection = 'main';
o = s.taboption('additional', form.Flag, 'dont_touch_dhcp', _('Dont touch my DHCP!'), _('Podkop will not change the DHCP config'));
o.default = '0';
o.rmempty = false;
o.ucisection = 'main';
// o = s.taboption('additional', form.Flag, 'dont_touch_dhcp', _('Dont touch my DHCP!'), _('Podkop will not change the DHCP config'));
// o.default = '0';
// o.rmempty = false;
// o.ucisection = 'main';
o = s.taboption('additional', form.Flag, 'exclude_ntp', _('Exclude NTP'), _('For issues with open connections sing-box'));
o.default = '0';
@@ -653,6 +653,50 @@ return view.extend({
o.rmempty = false;
o.ucisection = 'main';
o = s.taboption('additional', form.ListValue, 'dns_type', _('DNS Protocol Type'), _('Select DNS protocol to use'));
o.value('doh', _('DNS over HTTPS (DoH)'));
o.value('dot', _('DNS over TLS (DoT)'));
o.value('udp', _('UDP (Unprotected DNS)'));
o.default = 'doh';
o.rmempty = false;
o.ucisection = 'main';
o = s.taboption('additional', form.Value, 'dns_server', _('DNS Server'), _('Select or enter DNS server address'));
o.value('1.1.1.1', 'Cloudflare (1.1.1.1)');
o.value('8.8.8.8', 'Google (8.8.8.8)');
o.value('9.9.9.9', 'Quad9 (9.9.9.9)');
o.value('dns.adguard-dns.com', 'AdGuard Default (dns.adguard-dns.com)');
o.value('unfiltered.adguard-dns.com', 'AdGuard Unfiltered (unfiltered.adguard-dns.com)');
o.value('family.adguard-dns.com', 'AdGuard Family (family.adguard-dns.com)');
o.default = '1.1.1.1';
o.rmempty = false;
o.ucisection = 'main';
o.validate = function(section_id, value) {
if (!value) {
return _('DNS server address cannot be empty');
}
const ipRegex = /^(\d{1,3}\.){3}\d{1,3}$/;
if (ipRegex.test(value)) {
const parts = value.split('.');
for (const part of parts) {
const num = parseInt(part);
if (num < 0 || num > 255) {
return _('IP address parts must be between 0 and 255');
}
}
return true;
}
const domainRegex = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$/;
if (!domainRegex.test(value)) {
return _('Invalid DNS server format. Examples: 8.8.8.8 or dns.example.com');
}
return true;
};
// Diagnostics tab
o = s.tab('diagnostics', _('Diagnostics'));

View File

@@ -494,4 +494,31 @@ msgid "Update Lists"
msgstr "Обновить списки"
msgid "Lists Update Results"
msgstr "Результаты обновления списков"
msgstr "Результаты обновления списков"
msgid "DNS Protocol Type"
msgstr "Тип DNS протокола"
msgid "Select DNS protocol to use"
msgstr "Выберите протокол DNS"
msgid "DNS over HTTPS (DoH)"
msgstr "DNS через HTTPS (DoH)"
msgid "DNS over TLS (DoT)"
msgstr "DNS через TLS (DoT)"
msgid "UDP (Unprotected DNS)"
msgstr "UDP (Незащищённый DNS)"
msgid "DNS Server"
msgstr "DNS сервер"
msgid "Select or enter DNS server address"
msgstr "Выберите или введите адрес DNS сервера"
msgid "DNS server address cannot be empty"
msgstr "Адрес DNS сервера не может быть пустым"
msgid "Invalid DNS server format. Examples: 8.8.8.8 or dns.example.com"
msgstr "Неверный формат DNS сервера. Примеры: 8.8.8.8 или dns.example.com"

View File

@@ -854,4 +854,25 @@ msgid "Check completed"
msgstr ""
msgid "Check failed"
msgstr ""
msgid "DNS Protocol Type"
msgstr ""
msgid "Select DNS protocol to use"
msgstr ""
msgid "DNS over HTTPS (DoH)"
msgstr ""
msgid "DNS over TLS (DoT)"
msgstr ""
msgid "UDP (Unprotected DNS)"
msgstr ""
msgid "DNS Server"
msgstr ""
msgid "Select or enter DNS server address"
msgstr ""

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=podkop
PKG_VERSION:=0.3.11
PKG_VERSION:=0.3.13
PKG_RELEASE:=1
PKG_MAINTAINER:=ITDog <podkop@itdog.info>

View File

@@ -40,6 +40,8 @@ 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"
DNS_RESOLVERS="1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 9.9.9.9 9.9.9.11 94.140.14.14 94.140.15.15 208.67.220.220 208.67.222.222 77.88.8.1 77.88.8.8"
TEST_DOMAIN="google.com"
start_service() {
log "Start podkop"
@@ -334,7 +336,7 @@ save_dnsmasq_config() {
value=$(uci get "$key" 2>/dev/null)
if [ -z "$value" ]; then
uci -q delete "$backup_key"
uci set "$backup_key"="unset"
else
uci set "$backup_key"="$value"
fi
@@ -375,8 +377,9 @@ dnsmasq_restore() {
fi
local noresolv=$(uci get dhcp.@dnsmasq[0].podkop_noresolv 2>/dev/null)
if [ -z "$noresolv" ]; then
if [[ "$noresolv" == "unset" ]]; then
log "dnsmasq revert: noresolv is unset"
uci -q delete dhcp.@dnsmasq[0].noresolv
else
uci set dhcp.@dnsmasq[0].noresolv="$noresolv"
fi
@@ -545,6 +548,17 @@ list_update() {
config_foreach process_subnet_for_section_remote
}
find_working_resolver() {
local resolver_found=""
for resolver in $DNS_RESOLVERS; do
if nslookup $TEST_DOMAIN $resolver >/dev/null 2>&1; then
echo "$resolver"
return 0
fi
done
echo "8.8.8.8"
return 1
}
# sing-box funcs
@@ -622,27 +636,76 @@ sing_box_inbound_proxy() {
}
sing_box_dns() {
local dns_type
local dns_server
local resolver_tag="resolver"
config_get dns_type "main" "dns_type" "doh"
config_get dns_server "main" "dns_server" "1.1.1.1"
local server_json
local is_ip=$(echo "$dns_server" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' && echo "1" || echo "0")
if [ "$is_ip" = "0" ]; then
log "Finding working DNS resolver"
local dns_resolver=$(find_working_resolver)
log "Found working resolver: $dns_resolver"
fi
log "Configure DNS in sing-box"
server_json=$(jq -n \
--arg type "$dns_type" \
--arg server "$dns_server" \
--arg resolver "$resolver_tag" \
--arg is_ip "$is_ip" \
'{
"servers": [
{
"tag": "dns-server",
"address": (
if $type == "doh" then
"https://" + $server + "/dns-query"
elif $type == "dot" then
"tls://" + $server
else
$server
end
),
"detour": "direct-out"
} + (
if $is_ip == "0" then
{"address_resolver": $resolver}
else
{}
end
)
]
}')
if [ "$is_ip" = "0" ]; then
server_json=$(echo "$server_json" | jq \
--arg resolver "$resolver_tag" \
--arg address "$dns_resolver" \
'.servers += [{
"tag": $resolver,
"address": $address
}]')
fi
server_json=$(echo "$server_json" | jq '.servers += [{"tag": "fakeip-server", "address": "fakeip"}]')
jq \
--arg FAKEIP "$FAKEIP" \
'.dns = {
"strategy": "ipv4_only",
"fakeip": {
"enabled": true,
"inet4_range": $FAKEIP
},
"servers": [
{
"tag": "cloudflare-doh-server",
"address": "https://1.1.1.1/dns-query",
"detour": "direct-out"
--argjson dns_config "$server_json" \
--arg fakeip "$FAKEIP" \
'.dns = {
"strategy": "ipv4_only",
"fakeip": {
"enabled": true,
"inet4_range": $fakeip
},
{
"tag": "fakeip-server",
"address": "fakeip"
}
]
}' $SING_BOX_CONFIG >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
"servers": $dns_config.servers
}' $SING_BOX_CONFIG > /tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
}
sing_box_dns_rule_fakeip() {