Compare commits

...

6 Commits

Author SHA1 Message Date
itdoginfo
34d524ef51 Fix version 2025-02-15 12:20:28 +03:00
itdoginfo
c914d38ff2 Issue S99sing-box. Fixed repeat rulesset in sections 2025-02-15 11:52:31 +03:00
itdoginfo
543b66a6cc Message modification 2025-02-14 21:24:56 +03:00
itdoginfo
c046930032 Added migration 2025-02-14 21:06:44 +03:00
itdoginfo
12264b6ec0 Fix 2025-02-14 18:27:12 +03:00
itdoginfo
d4b7d77e10 Fix update_interval 2025-02-14 17:47:59 +03:00
5 changed files with 71 additions and 22 deletions

View File

@@ -90,7 +90,14 @@ Luci: Services/podkop
- [ ] `service network restart` ломает маршруты при sing-box
- [ ] Совпадение секции с ruleset ломает конфиг sing-box
- [ ] В каких-то случаях плохо отрабатывает localfile
- [ ] exit 1 если в конфиге присуствует
```
option doh_backup_noresolv '0'
list doh_backup_server ''
list doh_backup_server ''
list doh_server '127.0.0.1#5053'
list doh_server '127.0.0.1#5054'
```
# ToDo
Этот раздел не означает задачи, которые нужно брать и делать. Это общий список хотелок. Если вы хотите помочь, пожалуйста, спросите сначала в телеграмме.
@@ -140,6 +147,7 @@ Luci: Services/podkop
- [ ] Диагностика: Proxy check completed successfully предположительно не показывает IP, если вернулся это IPv6.
- [ ] Диагностика: podkop_domains: 0 elements как проверять что доходят запросы при fakeip? Мб врубать логи dnsmasq и их чекать.
- [ ] Сделать галку запрещающую подкопу редачить dhcp. Допилить в исключение вместе с пустыми полями proxy и vpn
- [ ] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
Приоритет 2
- [x] Списки доменов и подсетей с роутера

View File

@@ -28,7 +28,6 @@ main() {
case $UPDATE in
y)
echo "Upgraded podkop..."
sed -i '/second/d' /etc/config/podkop
break
;;
@@ -78,12 +77,12 @@ main() {
}
add_tunnel() {
echo "What type of VPN or proxy will be used? We also can automatically configure Wireguard and Amnezia WireGuard."
echo "Will you be using Wireguard, AmneziaWG, OpenVPN, OpenConnect? If yes, select a number and they will be automatically installed"
echo "1) Wireguard"
echo "2) AmneziaWG"
echo "3) OpenVPN"
echo "4) OpenConnect"
echo "5) Skip this step"
echo "5) I use VLESS/SS. Skip this step"
while true; do
read -r -p '' TUNNEL

View File

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

View File

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

View File

@@ -44,6 +44,15 @@ start_service() {
exit 1
fi
migration
# S99sing-box issue
if sing-box -c $SING_BOX_CONFIG check >/dev/null 2>&1; then
/etc/init.d/sing-box start
fi
sleep 5
config_foreach wget_github
mkdir -p /tmp/podkop
@@ -171,6 +180,20 @@ nolog() {
echo -e "${CYAN}[$timestamp]${RESET} ${GREEN}$message${RESET}"
}
# Migrations 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
# second remove
grep -q "config second 'second'" /etc/config/podkop && sed -i '/second/d' /etc/config/podkop
# 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
}
# Main funcs
route_table_rule_mark() {
@@ -289,6 +312,11 @@ wget_github() {
if [ "$domain_list_enabled" -eq 1 ] || [ "$subnets_list_enabled" -eq 1 ] ||
[ "$custom_download_domains_list_enabled" -eq 1 ] || [ "$custom_download_subnets_list_enabled" -eq 1 ] ; then
if ! nslookup google.com >/dev/null 2>&1; then
log "DNS not work"
exit 1
fi
while true; do
if ! curl -m 3 github.com; then
log "GitHub is not available. Check the internet availability [$count sec]"
@@ -481,20 +509,24 @@ sing_box_dns_rule_fakeip() {
sing_box_dns_rule_fakeip_section() {
local rule_set=$1
echo $rule_set
log "Adding section to fakeip route rules in sing-box"
jq \
--arg rule_set "$rule_set" \
'.dns.rules |= map(
if .server == "fakeip-server" then
.rule_set += [$rule_set]
if any(.rule_set[]?; . == $rule_set) then
.
else
.rule_set += [$rule_set]
end
else
.
end
)' $SING_BOX_CONFIG >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
)' "$SING_BOX_CONFIG" >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json "$SING_BOX_CONFIG"
}
sing_box_cache_file() {
log "Configure cache.db in sing-box"
jq \
@@ -515,7 +547,7 @@ sing_box_outdound() {
case "$mode" in
"vpn")
log "VPN mode"
log "You are using VPN mode, make sure you have installed all the necessary packages, configured, created the zone and forwarding."
log "You are using VPN mode, make sure you have installed all the necessary packages and configured."
config_get interface "$section" "interface"
sing_box_outbound_interface $section $interface
;;
@@ -603,7 +635,7 @@ sing_box_rule_dns() {
sing_box_config_check() {
if ! sing-box -c $SING_BOX_CONFIG check >/dev/null 2>&1; then
log "Sing-box configuration is invalid"
return
exit 1
fi
}
@@ -954,27 +986,37 @@ process_domains_for_section() {
}
sing_box_ruleset_remote() {
log "Configure ruleset remote in sing-box"
local tag=$1
local type=$2
local update_interval=$3
url="$SRS_MAIN_URL/$tag.srs"
jq \
--arg tag "$tag" \
--arg type "$type" \
--arg url "$url" \
--arg update_interval "$update_interval" \
'.route |= (if . == null then {rule_set: []} else . end) |
.route.rule_set += [{
local tag_exists=$(jq -r --arg tag "$tag" '
.route.rule_set[]? | select(.tag == $tag) | .tag
' "$SING_BOX_CONFIG")
if [[ -n "$tag_exists" ]]; then
log "Ruleset with tag $tag already exists. Skipping addition."
else
jq \
--arg tag "$tag" \
--arg type "$type" \
--arg url "$url" \
--arg update_interval "$update_interval" \
'
.route.rule_set += [
{
"tag": $tag,
"type": $type,
"format": "binary",
"url": $url,
"update_interval": $update_interval
}]' $SING_BOX_CONFIG >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
}
]' "$SING_BOX_CONFIG" > /tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json "$SING_BOX_CONFIG"
log "Added new ruleset with tag $tag"
fi
}
list_subnets_download() {