mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 19:46:52 +03:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc427cbd8a | ||
|
|
96ea424498 | ||
|
|
0ad4133202 |
@@ -93,8 +93,8 @@ opkg update && opkg install sing-box
|
|||||||
Приоритет 1
|
Приоритет 1
|
||||||
- [x] Переделать на PROCD и выкинуть ucitrack.
|
- [x] Переделать на PROCD и выкинуть ucitrack.
|
||||||
- [x] Нужен дебаг. Restart ucitrack в отдельный скрипт postinst, не отрабатывает.
|
- [x] Нужен дебаг. Restart ucitrack в отдельный скрипт postinst, не отрабатывает.
|
||||||
- [ ] Закомментировать дефолтные значения у list. interface поставить в пустое.
|
- [x] Закомментировать дефолтные значения у list. interface поставить в пустое.
|
||||||
- [ ] Скрипт установки: проверка установлен ли уже podkop. Если да, то просто предлагать обновится без установки тунелей и прокси.
|
- [x] Скрипт установки: проверка установлен ли уже podkop. Если да, то просто предлагать обновится без установки тунелей и прокси.
|
||||||
|
|
||||||
Приоритет 2
|
Приоритет 2
|
||||||
- [ ] Списки доменов и подсетей с роутера
|
- [ ] Списки доменов и подсетей с роутера
|
||||||
@@ -112,6 +112,7 @@ Wiki
|
|||||||
Низкий приоритет
|
Низкий приоритет
|
||||||
- [ ] Переменная, раз во сколько часов обновлять списки
|
- [ ] Переменная, раз во сколько часов обновлять списки
|
||||||
- [ ] Галочка, которая режет доступ к doh серверам
|
- [ ] Галочка, которая режет доступ к doh серверам
|
||||||
|
- [ ] Свой конфиг sing-box
|
||||||
|
|
||||||
Рефактор
|
Рефактор
|
||||||
- [ ] Handle для sing-box
|
- [ ] Handle для sing-box
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-podkop
|
PKG_NAME:=luci-app-podkop
|
||||||
PKG_VERSION:=0.2.1
|
PKG_VERSION:=0.2.3
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI podkop app
|
LUCI_TITLE:=LuCI podkop app
|
||||||
|
|||||||
10
luci-app-podkop/root/etc/uci-defaults/50_luci-podkop
Normal file
10
luci-app-podkop/root/etc/uci-defaults/50_luci-podkop
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
rm -f /var/luci-indexcache*
|
||||||
|
rm -f /tmp/luci-indexcache*
|
||||||
|
|
||||||
|
[ -x /etc/init.d/rpcd ] && /etc/init.d/rpcd reload
|
||||||
|
|
||||||
|
logger -t "podkop" "$timestamp uci-defaults script executed"
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=podkop
|
PKG_NAME:=podkop
|
||||||
PKG_VERSION:=0.2.1
|
PKG_VERSION:=0.2.3
|
||||||
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
|
||||||
|
|
||||||
|
rm -f /etc/hotplug.d/iface/50-podkop
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
config main 'main'
|
config main 'main'
|
||||||
option mode 'proxy'
|
option mode ''
|
||||||
option interface ''
|
option interface ''
|
||||||
option proxy_string ''
|
option proxy_string ''
|
||||||
option domain_list_enabled '1'
|
option domain_list_enabled '1'
|
||||||
|
|||||||
@@ -1,3 +1,28 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
/etc/init.d/podkop add_route_interface
|
. /lib/functions.sh
|
||||||
|
config_load "/etc/config/podkop"
|
||||||
|
. /etc/init.d/podkop
|
||||||
|
|
||||||
|
config_get "interface" "main" "interface" "0"
|
||||||
|
config_get "mode" "main" "mode" "0"
|
||||||
|
if [ "$mode" = "vpn" ] && [ -n "$interface" ]; then
|
||||||
|
add_route_interface "$interface" "podkop"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$mode" = "proxy" ]; then
|
||||||
|
echo "Add route for main tproxy"
|
||||||
|
add_route_tproxy podkop
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_get second_enable "second" "second_enable" "0"
|
||||||
|
config_get interface "second" "interface" "0"
|
||||||
|
config_get "mode" "second" "mode" "0"
|
||||||
|
if [ "$second_enable" -eq "1" ] && [ "$mode" = "vpn" ] && [ -n "$interface" ]; then
|
||||||
|
add_route_interface "$interface" "podkop2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$second_enable" -eq "1" ] && [ "$mode" = "proxy" ]; then
|
||||||
|
echo "Add route for second tproxy"
|
||||||
|
add_route_tproxy podkop2
|
||||||
|
fi
|
||||||
@@ -7,7 +7,7 @@ script=$(readlink "$initscript")
|
|||||||
NAME="$(basename ${script:-$initscript})"
|
NAME="$(basename ${script:-$initscript})"
|
||||||
config_load "$NAME"
|
config_load "$NAME"
|
||||||
|
|
||||||
EXTRA_COMMANDS="list_update add_route_interface version"
|
EXTRA_COMMANDS="list_update add_route_interface"
|
||||||
EXTRA_HELP=" list_update Updating domain and subnet lists
|
EXTRA_HELP=" list_update Updating domain and subnet lists
|
||||||
add_route_interface Adding route for interface
|
add_route_interface Adding route for interface
|
||||||
sing_box_config_vless For test vless string"
|
sing_box_config_vless For test vless string"
|
||||||
@@ -18,7 +18,6 @@ start_service() {
|
|||||||
log "Start podkop"
|
log "Start podkop"
|
||||||
|
|
||||||
dnsmasqfull
|
dnsmasqfull
|
||||||
ucitrack
|
|
||||||
routing_table_create
|
routing_table_create
|
||||||
add_mark
|
add_mark
|
||||||
|
|
||||||
@@ -44,7 +43,7 @@ start_service() {
|
|||||||
sing_box_config_vless "$proxy_string" "1603"
|
sing_box_config_vless "$proxy_string" "1603"
|
||||||
else
|
else
|
||||||
log "Unsupported proxy type: $proxy_string"
|
log "Unsupported proxy type: $proxy_string"
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
add_route_tproxy podkop2
|
add_route_tproxy podkop2
|
||||||
sing_box_config_check
|
sing_box_config_check
|
||||||
@@ -67,7 +66,7 @@ start_service() {
|
|||||||
log "Proxy mode"
|
log "Proxy mode"
|
||||||
if ! command -v sing-box >/dev/null 2>&1; then
|
if ! command -v sing-box >/dev/null 2>&1; then
|
||||||
log "Sing-box isn't installed. Proxy mode works with sing-box"
|
log "Sing-box isn't installed. Proxy mode works with sing-box"
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Main - proxy, Second - proxy
|
# Main - proxy, Second - proxy
|
||||||
@@ -85,7 +84,7 @@ start_service() {
|
|||||||
sing_box_config_outbound_vless "$proxy_string" "$outbound_main" main
|
sing_box_config_outbound_vless "$proxy_string" "$outbound_main" main
|
||||||
else
|
else
|
||||||
log "Unsupported proxy type: $proxy_string"
|
log "Unsupported proxy type: $proxy_string"
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_get proxy_string second "proxy_string"
|
config_get proxy_string second "proxy_string"
|
||||||
@@ -95,7 +94,7 @@ start_service() {
|
|||||||
sing_box_config_outbound_vless "$proxy_string" "$outbound_second" second
|
sing_box_config_outbound_vless "$proxy_string" "$outbound_second" second
|
||||||
else
|
else
|
||||||
log "Unsupported proxy type: $proxy_string"
|
log "Unsupported proxy type: $proxy_string"
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
jq --argjson outbounds "$(jq -s '{"outbounds": (.[0].outbounds + .[1].outbounds)}' "$outbound_main" "$outbound_second")" \
|
jq --argjson outbounds "$(jq -s '{"outbounds": (.[0].outbounds + .[1].outbounds)}' "$outbound_main" "$outbound_second")" \
|
||||||
@@ -118,7 +117,7 @@ start_service() {
|
|||||||
sing_box_config_vless "$proxy_string" "1602"
|
sing_box_config_vless "$proxy_string" "1602"
|
||||||
else
|
else
|
||||||
log "Unsupported proxy type: $proxy_string"
|
log "Unsupported proxy type: $proxy_string"
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
add_route_tproxy podkop
|
add_route_tproxy podkop
|
||||||
fi
|
fi
|
||||||
@@ -144,7 +143,7 @@ start_service() {
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "Requires *vpn* or *proxy* value"
|
log "Requires *vpn* or *proxy* value"
|
||||||
exit 1
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -244,6 +243,7 @@ reload_service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
|
log "service_triggers start"
|
||||||
procd_add_config_trigger "config.change" "$NAME" "$initscript" reload 'on_config_change'
|
procd_add_config_trigger "config.change" "$NAME" "$initscript" reload 'on_config_change'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,6 +255,7 @@ log() {
|
|||||||
local RESET="\033[0m"
|
local RESET="\033[0m"
|
||||||
|
|
||||||
echo -e "${CYAN}[$timestamp]${RESET} ${GREEN}$message${RESET}"
|
echo -e "${CYAN}[$timestamp]${RESET} ${GREEN}$message${RESET}"
|
||||||
|
logger -t "podkop" "$timestamp $message"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_cron_job() {
|
add_cron_job() {
|
||||||
@@ -370,15 +371,7 @@ dnsmasqfull() {
|
|||||||
log "Dnsmasq-full is not installed. Future: link only"
|
log "Dnsmasq-full is not installed. Future: link only"
|
||||||
log "Use script or:"
|
log "Use script or:"
|
||||||
log "cd /tmp/ && /bin/opkg download dnsmasq-full && /bin/opkg remove dnsmasq && /bin/opkg install dnsmasq-full --cache /tmp/ && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp"
|
log "cd /tmp/ && /bin/opkg download dnsmasq-full && /bin/opkg remove dnsmasq && /bin/opkg install dnsmasq-full --cache /tmp/ && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp"
|
||||||
exit 1
|
return
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
ucitrack() {
|
|
||||||
if grep -q "podkop" /etc/config/ucitrack; then
|
|
||||||
log "ucitrack config ok"
|
|
||||||
else
|
|
||||||
log "ucitrack config not found"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +429,7 @@ add_set() {
|
|||||||
|
|
||||||
*)
|
*)
|
||||||
log "Requires *vpn* or *proxy* value"
|
log "Requires *vpn* or *proxy* value"
|
||||||
exit 1
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@@ -444,23 +437,22 @@ add_set() {
|
|||||||
add_route_interface() {
|
add_route_interface() {
|
||||||
local interface="$1"
|
local interface="$1"
|
||||||
local table="$2"
|
local table="$2"
|
||||||
local retry_count_interface=0
|
|
||||||
local retry_count_route=0
|
local retry_count_route=0
|
||||||
local max_retries=20
|
local max_retries=10
|
||||||
|
|
||||||
while ! ip link show "$interface" >/dev/null 2>&1; do
|
if ! ip link show "$interface" >/dev/null 2>&1; then
|
||||||
if (( attempt == max_retries )); then
|
log "Interface "$interface" undetected, wait 10 sec..."
|
||||||
log "Interface "$interface" undetected after $retry_count_interface attempts. Exit"
|
sleep 10
|
||||||
exit 1
|
|
||||||
|
if ! ip link show "$interface" >/dev/null 2>&1; then
|
||||||
|
log "Interface "$interface" undetected. exit"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
log "Attempt $retry_count_interface: Interface "$interface" not found, retrying in 3 seconds..."
|
fi
|
||||||
retry_count_interface=$(( retry_count_interface + 1 ))
|
|
||||||
sleep 3
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! ip link show "$interface" >/dev/null 2>&1; then
|
if ! ip link show "$interface" >/dev/null 2>&1; then
|
||||||
log "Interface "$interface" does not exist, not possible to create a route"
|
log "Interface "$interface" does not exist, not possible to create a route"
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ip route show table $table | grep -q "^default dev"; then
|
if ip route show table $table | grep -q "^default dev"; then
|
||||||
@@ -481,7 +473,7 @@ add_route_interface() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
log "The maximum number of attempts has been exceeded. Failed to add a route."
|
log "The maximum number of attempts has been exceeded. Failed to add a route."
|
||||||
exit 1
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
add_route_tproxy() {
|
add_route_tproxy() {
|
||||||
@@ -532,7 +524,7 @@ lists_domains_download() {
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "Unidentified list of domains"
|
log "Unidentified list of domains"
|
||||||
exit 1
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -572,7 +564,7 @@ lists_services_download() {
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "Unidentified list of domains"
|
log "Unidentified list of domains"
|
||||||
exit 1
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -726,7 +718,7 @@ dnsmasq_config_check() {
|
|||||||
local config="$1"
|
local config="$1"
|
||||||
if ! /usr/sbin/dnsmasq --conf-file=/tmp/dnsmasq.d/$config --test 2>&1 | grep -q "syntax check OK"; then
|
if ! /usr/sbin/dnsmasq --conf-file=/tmp/dnsmasq.d/$config --test 2>&1 | grep -q "syntax check OK"; then
|
||||||
log "Dnsmasq config $config contains errors. Break"
|
log "Dnsmasq config $config contains errors. Break"
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -951,6 +943,6 @@ sing_box_config_outbound_vless() {
|
|||||||
sing_box_config_check() {
|
sing_box_config_check() {
|
||||||
if ! sing-box -c /etc/sing-box/config.json check >/dev/null 2>&1; then
|
if ! sing-box -c /etc/sing-box/config.json check >/dev/null 2>&1; then
|
||||||
log "Sing-box configuration is invalid"
|
log "Sing-box configuration is invalid"
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user