mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 11:36:50 +03:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b29a187d46 | ||
|
|
adecd707cd | ||
|
|
eba1cbef64 | ||
|
|
ad21de83a9 | ||
|
|
fae0e42722 | ||
|
|
50f702aef9 | ||
|
|
d9c1f2a95c | ||
|
|
ee8bef67ee | ||
|
|
dcc0733b89 | ||
|
|
e154718e90 | ||
|
|
a53adb2df1 | ||
|
|
fe245c31c3 | ||
|
|
ee6bbe3f13 | ||
|
|
8cf9f4b61b | ||
|
|
fea3ae8606 | ||
|
|
2524e08096 | ||
|
|
9754708fc1 | ||
|
|
afe96ff295 | ||
|
|
708cbe5a97 | ||
|
|
65efe20fd2 | ||
|
|
7b9f7ba605 | ||
|
|
415b5df621 | ||
|
|
0c8896bb6f | ||
|
|
bdcbba1376 | ||
|
|
d070ba5c4e |
22
README.md
22
README.md
@@ -20,6 +20,10 @@ sh <(wget -O - https://raw.githubusercontent.com/itdoginfo/domain-routing-openwr
|
||||
sh <(wget -O - https://raw.githubusercontent.com/itdoginfo/podkop/refs/heads/main/install.sh)
|
||||
```
|
||||
|
||||
Скрипт также предложит выбрать, какой туннель будет использоваться. Для выбранного туннеля будут установлены нужные пакеты, а для Wireguard и AmneziaWG также будет предложена автоматическая настройка - прямо в консоли скрипт запросит данные конфига. Для AmneziaWG можно также выбрать вариант с использованием конфига обычного Wireguard и автоматической обфускацией до AmneziaWG.
|
||||
|
||||
Для AmneziaWG скрипт проверяет наличие пакетов под вашу платформу в [стороннем репозитории](https://github.com/Slava-Shchipunov/awg-openwrt/releases), так как в официальном репозитории OpenWRT они отсутствуют, и автоматически их устанавливает.
|
||||
|
||||
## Вручную
|
||||
Сделать `opkg update`, чтоб установились зависимости.
|
||||
Скачать пакеты `podkop_*.ipk` и `luci-app-podkop_*.ipk` из релиза. `opkg install` сначала первый, потом второй.
|
||||
@@ -63,8 +67,10 @@ opkg update && opkg install sing-box
|
||||
|
||||
# Известные баги
|
||||
- [x] Не работает proxy при режимах main vpn, second proxy
|
||||
- [ ] Не всегда отрабатывает ucitrack (применение настроек из luci). Не удаётся повторить
|
||||
- [x] Не всегда отрабатывает ucitrack (применение настроек из luci). Не удаётся повторить
|
||||
- [x] All traffic for IP ломает инет на клиенте. Proxy mode
|
||||
- [ ] Не отрабатывает рестарт, при awg и не применяются изменения при awg
|
||||
- [ ] awg работает не стабильно
|
||||
|
||||
# ToDo
|
||||
Сделано
|
||||
@@ -87,23 +93,21 @@ opkg update && opkg install sing-box
|
||||
Приоритет 1
|
||||
- [x] Переделать на PROCD и выкинуть ucitrack.
|
||||
- [x] Нужен дебаг. Restart ucitrack в отдельный скрипт postinst, не отрабатывает.
|
||||
- [ ] Закомментировать дефолтные значения у list. interface поставить в пустое.
|
||||
- [ ] Скрипт установки: проверка установлен ли уже podkop. Если да, то просто предлагать обновится без установки тунелей и прокси.
|
||||
|
||||
Приоритет 2
|
||||
- [ ] Списки доменов и подсетей с роутера
|
||||
- [ ] Кнопка обновления списка доменов и подсетей
|
||||
- [ ] IPv6
|
||||
- [ ] Придумать автонастройку DNS через stubby итд. Как лучше это реализовать.
|
||||
- [ ] Удаление подсетей CF из domain sets раз в N часов
|
||||
- [ ] Автонастройка wireguard по примеру getdomains
|
||||
- [ ] Автонастройка awg по примеру getdomains
|
||||
- [x] Автонастройка wireguard по примеру getdomains
|
||||
- [x] Автонастройка awg по примеру getdomains
|
||||
|
||||
Wiki
|
||||
- [ ] Тема
|
||||
- [ ] Изначальное наполнение
|
||||
- [ ] Nginx+acme.sh ansible playbook
|
||||
- [ ] Сборка и деплой через github actions
|
||||
- [ ] Общий мониторинг VM
|
||||
- [ ] Мониторинг tls
|
||||
- [x] Тема
|
||||
- [x] Изначальное наполнение
|
||||
|
||||
Низкий приоритет
|
||||
- [ ] Переменная, раз во сколько часов обновлять списки
|
||||
|
||||
371
install.sh
371
install.sh
@@ -2,9 +2,11 @@
|
||||
|
||||
REPO="https://api.github.com/repos/itdoginfo/podkop/releases/latest"
|
||||
|
||||
IS_SHOULD_RESTART_NETWORK=false
|
||||
DOWNLOAD_DIR="/tmp/podkop"
|
||||
mkdir -p "$DOWNLOAD_DIR"
|
||||
|
||||
main() {
|
||||
wget -qO- "$REPO" | grep -o 'https://[^"]*\.ipk' | while read -r url; do
|
||||
filename=$(basename "$url")
|
||||
echo "Download $filename..."
|
||||
@@ -24,60 +26,331 @@ else
|
||||
[ -f /etc/config/dhcp-opkg ] && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp
|
||||
fi
|
||||
|
||||
echo "What type of VPN or proxy will be used?"
|
||||
echo "1) VLESS, Shadowsocks (A sing-box will be installed)"
|
||||
echo "2) Wireguard"
|
||||
echo "3) AmneziaWG"
|
||||
echo "4) OpenVPN"
|
||||
echo "5) OpenConnect"
|
||||
echo "6) Skip this step"
|
||||
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"
|
||||
|
||||
while true; do
|
||||
read -r -p '' TUNNEL
|
||||
case $TUNNEL in
|
||||
while true; do
|
||||
read -r -p '' UPDATE
|
||||
case $UPDATE in
|
||||
|
||||
1)
|
||||
opkg install sing-box
|
||||
break
|
||||
;;
|
||||
y)
|
||||
echo "Upgraded podkop..."
|
||||
break
|
||||
;;
|
||||
|
||||
2)
|
||||
opkg install wireguard-tools luci-proto-wireguard luci-app-wireguard
|
||||
printf "\e[1;32mUse these instructions to configure https://itdog.info/nastrojka-klienta-wireguard-na-openwrt/\e[0m\n"
|
||||
break
|
||||
;;
|
||||
|
||||
3)
|
||||
echo "As long as it's not automated"
|
||||
printf "\e[1;32mUse script from here https://github.com/Slava-Shchipunov/awg-openwrt\e[0m\n"
|
||||
break
|
||||
;;
|
||||
|
||||
4)
|
||||
opkg install opkg install openvpn-openssl luci-app-openvpn
|
||||
printf "\e[1;32mUse these instructions to configure https://itdog.info/nastrojka-klienta-openvpn-na-openwrt/\e[0m\n"
|
||||
break
|
||||
;;
|
||||
|
||||
5)
|
||||
opkg install opkg install openconnect luci-proto-openconnect
|
||||
printf "\e[1;32mUse these instructions to configure https://itdog.info/nastrojka-klienta-openconnect-na-openwrt/\e[0m\n"
|
||||
break
|
||||
;;
|
||||
|
||||
6)
|
||||
echo "Skip. Use this if you're installing an upgrade."
|
||||
break
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Choose from the following options"
|
||||
;;
|
||||
n)
|
||||
add_tunnel
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
else
|
||||
echo "Installed podkop..."
|
||||
add_tunnel
|
||||
fi
|
||||
|
||||
echo "Installed podkop..."
|
||||
opkg install $DOWNLOAD_DIR/podkop*.ipk
|
||||
opkg install $DOWNLOAD_DIR/luci-app-podkop*.ipk
|
||||
|
||||
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk
|
||||
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk
|
||||
|
||||
if [ "$IS_SHOULD_RESTART_NETWORK" ]; then
|
||||
printf "\033[32;1mRestart network\033[0m\n"
|
||||
/etc/init.d/network restart
|
||||
fi
|
||||
}
|
||||
|
||||
add_tunnel() {
|
||||
echo "What type of VPN or proxy will be used? We also can automatically configure Wireguard and Amnezia WireGuard."
|
||||
echo "1) VLESS, Shadowsocks (A sing-box will be installed)"
|
||||
echo "2) Wireguard"
|
||||
echo "3) AmneziaWG"
|
||||
echo "4) OpenVPN"
|
||||
echo "5) OpenConnect"
|
||||
echo "6) Skip this step"
|
||||
|
||||
while true; do
|
||||
read -r -p '' TUNNEL
|
||||
case $TUNNEL in
|
||||
|
||||
1)
|
||||
opkg install sing-box
|
||||
break
|
||||
;;
|
||||
|
||||
2)
|
||||
opkg install wireguard-tools luci-proto-wireguard luci-app-wireguard
|
||||
|
||||
printf "\033[32;1mDo you want to configure the wireguard interface? (y/n): \033[0m\n"
|
||||
read IS_SHOULD_CONFIGURE_WG_INTERFACE
|
||||
|
||||
if [ "$IS_SHOULD_CONFIGURE_WG_INTERFACE" = "y" ] || [ "$IS_SHOULD_CONFIGURE_WG_INTERFACE" = "Y" ]; then
|
||||
wg_awg_setup Wireguard
|
||||
else
|
||||
printf "\e[1;32mUse these instructions to manual configure https://itdog.info/nastrojka-klienta-wireguard-na-openwrt/\e[0m\n"
|
||||
fi
|
||||
|
||||
break
|
||||
;;
|
||||
|
||||
3)
|
||||
install_awg_packages
|
||||
|
||||
printf "\033[32;1mThere are no instructions for manual configure yet. Do you want to configure the amneziawg interface? (y/n): \033[0m\n"
|
||||
read IS_SHOULD_CONFIGURE_WG_INTERFACE
|
||||
|
||||
if [ "$IS_SHOULD_CONFIGURE_WG_INTERFACE" = "y" ] || [ "$IS_SHOULD_CONFIGURE_WG_INTERFACE" = "Y" ]; then
|
||||
wg_awg_setup AmneziaWG
|
||||
fi
|
||||
|
||||
break
|
||||
;;
|
||||
|
||||
4)
|
||||
opkg install opkg install openvpn-openssl luci-app-openvpn
|
||||
printf "\e[1;32mUse these instructions to configure https://itdog.info/nastrojka-klienta-openvpn-na-openwrt/\e[0m\n"
|
||||
break
|
||||
;;
|
||||
|
||||
5)
|
||||
opkg install opkg install openconnect luci-proto-openconnect
|
||||
printf "\e[1;32mUse these instructions to configure https://itdog.info/nastrojka-klienta-openconnect-na-openwrt/\e[0m\n"
|
||||
break
|
||||
;;
|
||||
|
||||
6)
|
||||
echo "Skip. Use this if you're installing an upgrade."
|
||||
break
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Choose from the following options"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
handler_network_restart() {
|
||||
IS_SHOULD_RESTART_NETWORK=true
|
||||
}
|
||||
|
||||
install_awg_packages() {
|
||||
# Получение pkgarch с наибольшим приоритетом
|
||||
PKGARCH=$(opkg print-architecture | awk 'BEGIN {max=0} {if ($3 > max) {max = $3; arch = $2}} END {print arch}')
|
||||
|
||||
TARGET=$(ubus call system board | jsonfilter -e '@.release.target' | cut -d '/' -f 1)
|
||||
SUBTARGET=$(ubus call system board | jsonfilter -e '@.release.target' | cut -d '/' -f 2)
|
||||
VERSION=$(ubus call system board | jsonfilter -e '@.release.version')
|
||||
PKGPOSTFIX="_v${VERSION}_${PKGARCH}_${TARGET}_${SUBTARGET}.ipk"
|
||||
BASE_URL="https://github.com/Slava-Shchipunov/awg-openwrt/releases/download/"
|
||||
|
||||
AWG_DIR="/tmp/amneziawg"
|
||||
mkdir -p "$AWG_DIR"
|
||||
|
||||
if opkg list-installed | grep -q kmod-amneziawg; then
|
||||
echo "kmod-amneziawg already installed"
|
||||
else
|
||||
KMOD_AMNEZIAWG_FILENAME="kmod-amneziawg${PKGPOSTFIX}"
|
||||
DOWNLOAD_URL="${BASE_URL}v${VERSION}/${KMOD_AMNEZIAWG_FILENAME}"
|
||||
wget -O "$AWG_DIR/$KMOD_AMNEZIAWG_FILENAME" "$DOWNLOAD_URL"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "kmod-amneziawg file downloaded successfully"
|
||||
else
|
||||
echo "Error downloading kmod-amneziawg. Please, install kmod-amneziawg manually and run the script again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
opkg install "$AWG_DIR/$KMOD_AMNEZIAWG_FILENAME"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "kmod-amneziawg file downloaded successfully"
|
||||
else
|
||||
echo "Error installing kmod-amneziawg. Please, install kmod-amneziawg manually and run the script again"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if opkg list-installed | grep -q amneziawg-tools; then
|
||||
echo "amneziawg-tools already installed"
|
||||
else
|
||||
AMNEZIAWG_TOOLS_FILENAME="amneziawg-tools${PKGPOSTFIX}"
|
||||
DOWNLOAD_URL="${BASE_URL}v${VERSION}/${AMNEZIAWG_TOOLS_FILENAME}"
|
||||
wget -O "$AWG_DIR/$AMNEZIAWG_TOOLS_FILENAME" "$DOWNLOAD_URL"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "amneziawg-tools file downloaded successfully"
|
||||
else
|
||||
echo "Error downloading amneziawg-tools. Please, install amneziawg-tools manually and run the script again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
opkg install "$AWG_DIR/$AMNEZIAWG_TOOLS_FILENAME"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "amneziawg-tools file downloaded successfully"
|
||||
else
|
||||
echo "Error installing amneziawg-tools. Please, install amneziawg-tools manually and run the script again"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if opkg list-installed | grep -q luci-app-amneziawg; then
|
||||
echo "luci-app-amneziawg already installed"
|
||||
else
|
||||
LUCI_APP_AMNEZIAWG_FILENAME="luci-app-amneziawg${PKGPOSTFIX}"
|
||||
DOWNLOAD_URL="${BASE_URL}v${VERSION}/${LUCI_APP_AMNEZIAWG_FILENAME}"
|
||||
wget -O "$AWG_DIR/$LUCI_APP_AMNEZIAWG_FILENAME" "$DOWNLOAD_URL"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "luci-app-amneziawg file downloaded successfully"
|
||||
else
|
||||
echo "Error downloading luci-app-amneziawg. Please, install luci-app-amneziawg manually and run the script again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
opkg install "$AWG_DIR/$LUCI_APP_AMNEZIAWG_FILENAME"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "luci-app-amneziawg file downloaded successfully"
|
||||
else
|
||||
echo "Error installing luci-app-amneziawg. Please, install luci-app-amneziawg manually and run the script again"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf "$AWG_DIR"
|
||||
}
|
||||
|
||||
wg_awg_setup() {
|
||||
PROTOCOL_NAME=$1
|
||||
printf "\033[32;1mConfigure ${PROTOCOL_NAME}\033[0m\n"
|
||||
if [ "$PROTOCOL_NAME" = 'Wireguard' ]; then
|
||||
INTERFACE_NAME="wg0"
|
||||
CONFIG_NAME="wireguard_wg0"
|
||||
PROTO="wireguard"
|
||||
ZONE_NAME="wg"
|
||||
fi
|
||||
|
||||
if [ "$PROTOCOL_NAME" = 'AmneziaWG' ]; then
|
||||
INTERFACE_NAME="awg0"
|
||||
CONFIG_NAME="amneziawg_awg0"
|
||||
PROTO="amneziawg"
|
||||
ZONE_NAME="awg"
|
||||
|
||||
echo "Do you want to use AmneziaWG config or basic Wireguard config + automatic obfuscation?"
|
||||
echo "1) AmneziaWG"
|
||||
echo "2) Wireguard + automatic obfuscation"
|
||||
read CONFIG_TYPE
|
||||
fi
|
||||
|
||||
read -r -p "Enter the private key (from [Interface]):"$'\n' WG_PRIVATE_KEY_INT
|
||||
|
||||
while true; do
|
||||
read -r -p "Enter internal IP address with subnet, example 192.168.100.5/24 (from [Interface]):"$'\n' WG_IP
|
||||
if echo "$WG_IP" | egrep -oq '^([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]+$'; then
|
||||
break
|
||||
else
|
||||
echo "This IP is not valid. Please repeat"
|
||||
fi
|
||||
done
|
||||
|
||||
read -r -p "Enter the public key (from [Peer]):"$'\n' WG_PUBLIC_KEY_INT
|
||||
read -r -p "If use PresharedKey, Enter this (from [Peer]). If your don't use leave blank:"$'\n' WG_PRESHARED_KEY_INT
|
||||
read -r -p "Enter Endpoint host without port (Domain or IP) (from [Peer]):"$'\n' WG_ENDPOINT_INT
|
||||
|
||||
read -r -p "Enter Endpoint host port (from [Peer]) [51820]:"$'\n' WG_ENDPOINT_PORT_INT
|
||||
WG_ENDPOINT_PORT_INT=${WG_ENDPOINT_PORT_INT:-51820}
|
||||
if [ "$WG_ENDPOINT_PORT_INT" = '51820' ]; then
|
||||
echo $WG_ENDPOINT_PORT_INT
|
||||
fi
|
||||
|
||||
if [ "$PROTOCOL_NAME" = 'AmneziaWG' ]; then
|
||||
if [ "$CONFIG_TYPE" = '1' ]; then
|
||||
read -r -p "Enter Jc value (from [Interface]):"$'\n' AWG_JC
|
||||
read -r -p "Enter Jmin value (from [Interface]):"$'\n' AWG_JMIN
|
||||
read -r -p "Enter Jmax value (from [Interface]):"$'\n' AWG_JMAX
|
||||
read -r -p "Enter S1 value (from [Interface]):"$'\n' AWG_S1
|
||||
read -r -p "Enter S2 value (from [Interface]):"$'\n' AWG_S2
|
||||
read -r -p "Enter H1 value (from [Interface]):"$'\n' AWG_H1
|
||||
read -r -p "Enter H2 value (from [Interface]):"$'\n' AWG_H2
|
||||
read -r -p "Enter H3 value (from [Interface]):"$'\n' AWG_H3
|
||||
read -r -p "Enter H4 value (from [Interface]):"$'\n' AWG_H4
|
||||
elif [ "$CONFIG_TYPE" = '2' ]; then
|
||||
#Default values to wg automatic obfuscation
|
||||
AWG_JC=4
|
||||
AWG_JMIN=40
|
||||
AWG_JMAX=70
|
||||
AWG_S1=0
|
||||
AWG_S2=0
|
||||
AWG_H1=1
|
||||
AWG_H2=2
|
||||
AWG_H3=3
|
||||
AWG_H4=4
|
||||
fi
|
||||
fi
|
||||
|
||||
uci set network.${INTERFACE_NAME}=interface
|
||||
uci set network.${INTERFACE_NAME}.proto=$PROTO
|
||||
uci set network.${INTERFACE_NAME}.private_key=$WG_PRIVATE_KEY_INT
|
||||
uci set network.${INTERFACE_NAME}.listen_port='51821'
|
||||
uci set network.${INTERFACE_NAME}.addresses=$WG_IP
|
||||
|
||||
if [ "$PROTOCOL_NAME" = 'AmneziaWG' ]; then
|
||||
uci set network.${INTERFACE_NAME}.awg_jc=$AWG_JC
|
||||
uci set network.${INTERFACE_NAME}.awg_jmin=$AWG_JMIN
|
||||
uci set network.${INTERFACE_NAME}.awg_jmax=$AWG_JMAX
|
||||
uci set network.${INTERFACE_NAME}.awg_s1=$AWG_S1
|
||||
uci set network.${INTERFACE_NAME}.awg_s2=$AWG_S2
|
||||
uci set network.${INTERFACE_NAME}.awg_h1=$AWG_H1
|
||||
uci set network.${INTERFACE_NAME}.awg_h2=$AWG_H2
|
||||
uci set network.${INTERFACE_NAME}.awg_h3=$AWG_H3
|
||||
uci set network.${INTERFACE_NAME}.awg_h4=$AWG_H4
|
||||
fi
|
||||
|
||||
if ! uci show network | grep -q ${CONFIG_NAME}; then
|
||||
uci add network ${CONFIG_NAME}
|
||||
fi
|
||||
|
||||
uci set network.@${CONFIG_NAME}[0]=$CONFIG_NAME
|
||||
uci set network.@${CONFIG_NAME}[0].name="${INTERFACE_NAME}_client"
|
||||
uci set network.@${CONFIG_NAME}[0].public_key=$WG_PUBLIC_KEY_INT
|
||||
uci set network.@${CONFIG_NAME}[0].preshared_key=$WG_PRESHARED_KEY_INT
|
||||
uci set network.@${CONFIG_NAME}[0].route_allowed_ips='0'
|
||||
uci set network.@${CONFIG_NAME}[0].persistent_keepalive='25'
|
||||
uci set network.@${CONFIG_NAME}[0].endpoint_host=$WG_ENDPOINT_INT
|
||||
uci set network.@${CONFIG_NAME}[0].allowed_ips='0.0.0.0/0'
|
||||
uci set network.@${CONFIG_NAME}[0].endpoint_port=$WG_ENDPOINT_PORT_INT
|
||||
uci commit network
|
||||
|
||||
if ! uci show firewall | grep -q "@zone.*name='${ZONE_NAME}'"; then
|
||||
printf "\033[32;1mZone Create\033[0m\n"
|
||||
uci add firewall zone
|
||||
uci set firewall.@zone[-1].name=$ZONE_NAME
|
||||
uci set firewall.@zone[-1].network=$INTERFACE_NAME
|
||||
uci set firewall.@zone[-1].forward='REJECT'
|
||||
uci set firewall.@zone[-1].output='ACCEPT'
|
||||
uci set firewall.@zone[-1].input='REJECT'
|
||||
uci set firewall.@zone[-1].masq='1'
|
||||
uci set firewall.@zone[-1].mtu_fix='1'
|
||||
uci set firewall.@zone[-1].family='ipv4'
|
||||
uci commit firewall
|
||||
fi
|
||||
|
||||
if ! uci show firewall | grep -q "@forwarding.*name='${ZONE_NAME}'"; then
|
||||
printf "\033[32;1mConfigured forwarding\033[0m\n"
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1]=forwarding
|
||||
uci set firewall.@forwarding[-1].name="${ZONE_NAME}-lan"
|
||||
uci set firewall.@forwarding[-1].dest=${ZONE_NAME}
|
||||
uci set firewall.@forwarding[-1].src='lan'
|
||||
uci set firewall.@forwarding[-1].family='ipv4'
|
||||
uci commit firewall
|
||||
fi
|
||||
|
||||
handler_network_restart
|
||||
}
|
||||
|
||||
main
|
||||
@@ -4,7 +4,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-podkop
|
||||
PKG_VERSION:=0.2.0
|
||||
PKG_VERSION:=0.2.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LUCI_TITLE:=LuCI podkop app
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=podkop
|
||||
PKG_VERSION:=0.2.0
|
||||
PKG_VERSION:=0.2.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=ITDog <podkop@itdog.info>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
config main 'main'
|
||||
option mode 'proxy'
|
||||
option interface 'wg0'
|
||||
option interface ''
|
||||
option proxy_string ''
|
||||
option domain_list_enabled '1'
|
||||
option domain_list 'ru_inside'
|
||||
option subnets_list_enabled '0'
|
||||
list subnets 'twitter'
|
||||
#list subnets 'twitter'
|
||||
option custom_domains_list_enabled '0'
|
||||
list custom_domains ''
|
||||
#list custom_domains ''
|
||||
option custom_download_domains_list_enabled '0'
|
||||
list custom_download_domains ''
|
||||
#list custom_download_domains ''
|
||||
option custom_subnets_list_enabled '0'
|
||||
list custom_subnets ''
|
||||
#list custom_subnets ''
|
||||
option custom_download_subnets_list_enabled '0'
|
||||
list custom_download_subnets ''
|
||||
#list custom_download_subnets ''
|
||||
option all_traffic_from_ip_enabled '0'
|
||||
list all_traffic_ip ''
|
||||
#list all_traffic_ip ''
|
||||
option delist_domains_enabled '0'
|
||||
list delist_domains ''
|
||||
#list delist_domains ''
|
||||
option exclude_from_ip_enabled '0'
|
||||
list exclude_traffic_ip ''
|
||||
#list exclude_traffic_ip ''
|
||||
option yacd '0'
|
||||
option socks5 '0'
|
||||
option exclude_ntp '0'
|
||||
@@ -30,8 +30,8 @@ config second 'second'
|
||||
option interface 'wg1'
|
||||
option proxy_string ''
|
||||
option domain_list_enabled '0'
|
||||
list domains 'youtube'
|
||||
#list domains 'youtube'
|
||||
option custom_domains_list_enabled '0'
|
||||
list custom_domains 'ifconfig.io'
|
||||
#list custom_domains 'ifconfig.io'
|
||||
option custom_subnets_list_enabled '0'
|
||||
list custom_subnets ''
|
||||
#list custom_subnets ''
|
||||
@@ -444,9 +444,20 @@ add_set() {
|
||||
add_route_interface() {
|
||||
local interface="$1"
|
||||
local table="$2"
|
||||
local retry_count=0
|
||||
local retry_count_interface=0
|
||||
local retry_count_route=0
|
||||
local max_retries=20
|
||||
|
||||
while ! ip link show "$interface" >/dev/null 2>&1; do
|
||||
if (( attempt == max_retries )); then
|
||||
log "Interface "$interface" undetected after $retry_count_interface attempts. Exit"
|
||||
exit 1
|
||||
fi
|
||||
log "Attempt $retry_count_interface: Interface "$interface" not found, retrying in 3 seconds..."
|
||||
retry_count_interface=$(( retry_count_interface + 1 ))
|
||||
sleep 3
|
||||
done
|
||||
|
||||
if ! ip link show "$interface" >/dev/null 2>&1; then
|
||||
log "Interface "$interface" does not exist, not possible to create a route"
|
||||
exit 1
|
||||
@@ -458,11 +469,11 @@ add_route_interface() {
|
||||
fi
|
||||
|
||||
log "Added route for "$interface""
|
||||
while [ $retry_count -lt $max_retries ]; do
|
||||
while [ $retry_count_route -lt $max_retries ]; do
|
||||
if ip route add table $table default dev "$interface" 2>&1 | grep -q "Network is down"; then
|
||||
log "Error: Network is down. Let's try again in 3 seconds"
|
||||
log "Attempt $retry_count_route: Interface "$interface" is down, retrying in 3 seconds..."
|
||||
sleep 3
|
||||
retry_count=$((retry_count + 1))
|
||||
retry_count_route=$((retry_count_route + 1))
|
||||
else
|
||||
log "Route for "$interface" added"
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user