Nft move br-lan to mark, renamed secondary, fixed po template

This commit is contained in:
itdoginfo
2024-11-13 00:44:26 +03:00
parent a5d6b202a9
commit d232023140
6 changed files with 59 additions and 58 deletions

View File

@@ -99,11 +99,11 @@ opkg update && opkg install sing-box
- [x] Скрипт установки: проверка установлен ли уже podkop. Если да, то просто предлагать обновится без установки тунелей и прокси. - [x] Скрипт установки: проверка установлен ли уже podkop. Если да, то просто предлагать обновится без установки тунелей и прокси.
Приоритет 1 Приоритет 1
- [ ] Изменить название "Alternative Config" - [x] Изменить название "Alternative Config"
- [ ] "domain_service_enabled" Добавить _second - [x] "domain_service_enabled" Добавить _second
- [ ] Установка Ru пакета в install.sh - [ ] Установка Ru пакета в install.sh
- [ ] Правка nft mark, tproxy - [x] Правка nft mark, tproxy
- [ ] Правка перевода - [x] Правка перевода минимальная
Приоритет 2 Приоритет 2
- [ ] Списки доменов и подсетей с роутера - [ ] Списки доменов и подсетей с роутера
@@ -117,7 +117,7 @@ Wiki
- [x] Изначальное наполнение - [x] Изначальное наполнение
Низкий приоритет Низкий приоритет
- [ ] Переменная, раз во сколько часов обновлять списки - [x] Переменная, раз во сколько часов обновлять списки
- [ ] Галочка, которая режет доступ к doh серверам - [ ] Галочка, которая режет доступ к doh серверам
- [ ] Свой конфиг sing-box - [ ] Свой конфиг sing-box

View File

@@ -53,7 +53,7 @@ return view.extend({
o.rmempty = false; o.rmempty = false;
o.ucisection = 'main'; o.ucisection = 'main';
o = s.taboption('basic', form.ListValue, 'domain_list', _('Domain List'), _('Select a list <a href="https://github.com/itdoginfo/allow-domains" target="_blank">github.com/itdoginfo/allow-domains</a>')); o = s.taboption('basic', form.ListValue, 'domain_list', _('Domain List'), _('Select a list') + ' <a href="https://github.com/itdoginfo/allow-domains" target="_blank">github.com/itdoginfo/allow-domains</a>');
o.placeholder = 'placeholder'; o.placeholder = 'placeholder';
o.value('ru_inside', 'Russia inside'); o.value('ru_inside', 'Russia inside');
o.value('ru_outside', 'Russia outside'); o.value('ru_outside', 'Russia outside');
@@ -302,24 +302,24 @@ return view.extend({
// Secondary Settings Tab // Secondary Settings Tab
o = s.tab('alternative_config', _('Alternative Config')); o = s.tab('secondary_config', _('Secondary Config'));
o = s.taboption('alternative_config', form.Flag, 'second_enable', _('Alternative VPN/Proxy Enable'), _('Enable alternative VPN/Proxy configuration')); o = s.taboption('secondary_config', form.Flag, 'second_enable', _('Secondary VPN/Proxy Enable'), _('Enable secondary VPN/Proxy configuration'));
o.default = '0'; o.default = '0';
o.rmempty = false; o.rmempty = false;
o.ucisection = 'second'; o.ucisection = 'second';
o = s.taboption('alternative_config', form.ListValue, 'second_mode', _('Connection Type'), _('Select between VPN and Proxy connection methods for traffic routing')); o = s.taboption('secondary_config', form.ListValue, 'second_mode', _('Connection Type'), _('Select between VPN and Proxy connection methods for traffic routing'));
o.value('vpn', ('VPN')); o.value('vpn', ('VPN'));
o.value('proxy', ('Proxy')); o.value('proxy', ('Proxy'));
o.depends('second_enable', '1'); o.depends('second_enable', '1');
o.ucisection = 'second'; o.ucisection = 'second';
o = s.taboption('alternative_config', form.TextValue, 'second_proxy_string', _('Proxy Configuration URL'), _('Enter connection string starting with vless:// or ss:// for proxy configuration')); o = s.taboption('secondary_config', form.TextValue, 'second_proxy_string', _('Proxy Configuration URL'), _('Enter connection string starting with vless:// or ss:// for proxy configuration'));
o.depends('second_mode', 'proxy'); o.depends('second_mode', 'proxy');
o.ucisection = 'second'; o.ucisection = 'second';
o = s.taboption('alternative_config', form.ListValue, 'second_interface', _('Network Interface'), _('Select network interface for VPN connection')); o = s.taboption('secondary_config', form.ListValue, 'second_interface', _('Network Interface'), _('Select network interface for VPN connection'));
o.depends('second_mode', 'vpn'); o.depends('second_mode', 'vpn');
o.ucisection = 'second'; o.ucisection = 'second';
@@ -341,26 +341,26 @@ return view.extend({
console.error('Error fetching devices:', error); console.error('Error fetching devices:', error);
} }
o = s.taboption('alternative_config', form.Flag, 'domain_service_enabled', _('Service Domain List Enable'), _('Enable predefined service domain lists for routing')); o = s.taboption('secondary_config', form.Flag, 'second_domain_service_enabled', _('Service Domain List Enable'), _('Enable predefined service domain lists for routing'));
o.default = '0'; o.default = '0';
o.rmempty = false; o.rmempty = false;
o.depends('second_enable', '1'); o.depends('second_enable', '1');
o.ucisection = 'second'; o.ucisection = 'second';
o = s.taboption('alternative_config', form.ListValue, 'service_list', _('Service List'), _('Select predefined services for routing')); o = s.taboption('secondary_config', form.ListValue, 'second_service_list', _('Service List'), _('Select predefined services for routing'));
o.placeholder = 'placeholder'; o.placeholder = 'placeholder';
o.value('youtube', 'Youtube'); o.value('youtube', 'Youtube');
o.depends('domain_service_enabled', '1'); o.depends('second_domain_service_enabled', '1');
o.rmempty = false; o.rmempty = false;
o.ucisection = 'second'; o.ucisection = 'second';
o = s.taboption('alternative_config', form.Flag, 'second_custom_domains_list_enabled', _('User Domain List'), _('Enable and manage your custom list of domains for selective routing')); o = s.taboption('secondary_config', form.Flag, 'second_custom_domains_list_enabled', _('User Domain List'), _('Enable and manage your custom list of domains for selective routing'));
o.default = '0'; o.default = '0';
o.rmempty = false; o.rmempty = false;
o.depends('second_enable', '1'); o.depends('second_enable', '1');
o.ucisection = 'second'; o.ucisection = 'second';
o = s.taboption('alternative_config', form.DynamicList, 'second_custom_domains', _('User Domains'), _('Enter domain names without protocols (example: sub.example.com or example.com)')); o = s.taboption('secondary_config', form.DynamicList, 'second_custom_domains', _('User Domains'), _('Enter domain names without protocols (example: sub.example.com or example.com)'));
o.placeholder = 'Domains list'; o.placeholder = 'Domains list';
o.depends('second_custom_domains_list_enabled', '1'); o.depends('second_custom_domains_list_enabled', '1');
o.rmempty = false; o.rmempty = false;
@@ -378,13 +378,13 @@ return view.extend({
return true; return true;
}; };
o = s.taboption('alternative_config', form.Flag, 'second_custom_subnets_list_enabled', _('User Subnet List'), _('Enable and manage your custom list of IP subnets for selective routing')); o = s.taboption('secondary_config', form.Flag, 'second_custom_subnets_list_enabled', _('User Subnet List'), _('Enable and manage your custom list of IP subnets for selective routing'));
o.default = '0'; o.default = '0';
o.rmempty = false; o.rmempty = false;
o.depends('second_enable', '1'); o.depends('second_enable', '1');
o.ucisection = 'second'; o.ucisection = 'second';
o = s.taboption('alternative_config', form.DynamicList, 'second_custom_subnets', _('User Subnets'), _('Enter subnet in CIDR notation (example: 103.21.244.0/22)')); o = s.taboption('secondary_config', form.DynamicList, 'second_custom_subnets', _('User Subnets'), _('Enter subnet in CIDR notation (example: 103.21.244.0/22)'));
o.placeholder = 'Subnets list'; o.placeholder = 'Subnets list';
o.depends('second_custom_subnets_list_enabled', '1'); o.depends('second_custom_subnets_list_enabled', '1');
o.rmempty = false; o.rmempty = false;

View File

@@ -10,13 +10,13 @@ msgstr "Основные настройки"
msgid "Additional Settings" msgid "Additional Settings"
msgstr "Дополнительные настройки" msgstr "Дополнительные настройки"
msgid "Alternative Config" msgid "Secondary Config"
msgstr "Альтернативная конфигурация" msgstr "Альтернативная конфигурация"
msgid "Alternative VPN/Proxy Enable" msgid "Secondary VPN/Proxy Enable"
msgstr "Включить альтернативный VPN/Proxy" msgstr "Включить альтернативный VPN/Proxy"
msgid "Enable alternative VPN/Proxy configuration" msgid "Enable secondary VPN/Proxy configuration"
msgstr "Включить конфигурацию альтернативного VPN/Proxy" msgstr "Включить конфигурацию альтернативного VPN/Proxy"
msgid "Connection Type" msgid "Connection Type"
@@ -37,16 +37,16 @@ msgstr "Сетевой интерфейс"
msgid "Select network interface for VPN connection" msgid "Select network interface for VPN connection"
msgstr "Выберите сетевой интерфейс для VPN подключения" msgstr "Выберите сетевой интерфейс для VPN подключения"
msgid "Predefined Domain Lists" msgid "Community Domain Lists"
msgstr "Предустановленные списки доменов" msgstr "Предустановленные списки доменов"
msgid "Domain List" msgid "Domain List"
msgstr "Список доменов" msgstr "Список доменов"
msgid "Select a predefined domain list" msgid "Select a list"
msgstr "Выберите предустановленный список доменов" msgstr "Выберите список доменов"
msgid "Predefined Service Networks" msgid "Community Subnet Lists"
msgstr "Предустановленные сети сервисов" msgstr "Предустановленные сети сервисов"
msgid "Enable routing for popular services like Twitter, Meta, and Discord" msgid "Enable routing for popular services like Twitter, Meta, and Discord"
@@ -91,8 +91,8 @@ msgstr "Включить и управлять пользовательским
msgid "User Subnets" msgid "User Subnets"
msgstr "Пользовательские подсети" msgstr "Пользовательские подсети"
msgid "Enter subnet in CIDR notation (example: 192.168.1.0/24)" msgid "Enter subnet in CIDR notation (example: 103.21.244.0/22)"
msgstr "Введите подсеть в нотации CIDR (пример: 192.168.1.0/24)" msgstr "Введите подсеть в нотации CIDR (пример: 103.21.244.0/22)"
msgid "Remote Subnet Lists" msgid "Remote Subnet Lists"
msgstr "Удаленные списки подсетей" msgstr "Удаленные списки подсетей"
@@ -115,7 +115,7 @@ msgstr "Исключенные домены"
msgid "Domains to be excluded from routing" msgid "Domains to be excluded from routing"
msgstr "Домены, которые будут исключены из маршрутизации" msgstr "Домены, которые будут исключены из маршрутизации"
msgid "Force Proxy IPs" msgid "IP for full redirection"
msgstr "Принудительные прокси IP" msgstr "Принудительные прокси IP"
msgid "Specify local IP addresses whose traffic will always use the configured route" msgid "Specify local IP addresses whose traffic will always use the configured route"
@@ -127,7 +127,7 @@ msgstr "Локальные IP"
msgid "Enter valid IPv4 addresses" msgid "Enter valid IPv4 addresses"
msgstr "Введите действительные IPv4 адреса" msgstr "Введите действительные IPv4 адреса"
msgid "Bypass Proxy IPs" msgid "IP for exclusion"
msgstr "Исключения прокси IP" msgstr "Исключения прокси IP"
msgid "Specify local IP addresses that will never use the configured route" msgid "Specify local IP addresses that will never use the configured route"

View File

@@ -10,13 +10,13 @@ msgstr ""
msgid "Additional Settings" msgid "Additional Settings"
msgstr "" msgstr ""
msgid "Alternative Config" msgid "Secondary Config"
msgstr "" msgstr ""
msgid "Alternative VPN/Proxy Enable" msgid "Secondary VPN/Proxy Enable"
msgstr "" msgstr ""
msgid "Enable alternative VPN/Proxy configuration" msgid "Enable secondary VPN/Proxy configuration"
msgstr "" msgstr ""
msgid "Connection Type" msgid "Connection Type"
@@ -37,16 +37,16 @@ msgstr ""
msgid "Select network interface for VPN connection" msgid "Select network interface for VPN connection"
msgstr "" msgstr ""
msgid "Predefined Domain Lists" msgid "Community Domain Lists"
msgstr "" msgstr ""
msgid "Domain List" msgid "Domain List"
msgstr "" msgstr ""
msgid "Select a predefined domain list" msgid "Select a list"
msgstr "" msgstr ""
msgid "Predefined Service Networks" msgid "Community Subnet Lists"
msgstr "" msgstr ""
msgid "Enable routing for popular services like Twitter, Meta, and Discord" msgid "Enable routing for popular services like Twitter, Meta, and Discord"
@@ -91,7 +91,7 @@ msgstr ""
msgid "User Subnets" msgid "User Subnets"
msgstr "" msgstr ""
msgid "Enter subnet in CIDR notation (example: 192.168.1.0/24)" msgid "Enter subnet in CIDR notation (example: 103.21.244.0/22)"
msgstr "" msgstr ""
msgid "Remote Subnet Lists" msgid "Remote Subnet Lists"
@@ -115,7 +115,7 @@ msgstr ""
msgid "Domains to be excluded from routing" msgid "Domains to be excluded from routing"
msgstr "" msgstr ""
msgid "Force Proxy IPs" msgid "IP for full redirection"
msgstr "" msgstr ""
msgid "Specify local IP addresses whose traffic will always use the configured route" msgid "Specify local IP addresses whose traffic will always use the configured route"
@@ -127,7 +127,7 @@ msgstr ""
msgid "Enter valid IPv4 addresses" msgid "Enter valid IPv4 addresses"
msgstr "" msgstr ""
msgid "Bypass Proxy IPs" msgid "IP for exclusion"
msgstr "" msgstr ""
msgid "Specify local IP addresses that will never use the configured route" msgid "Specify local IP addresses that will never use the configured route"
@@ -208,7 +208,7 @@ msgstr ""
msgid "Invalid URL format. URL must start with http:// or https://" msgid "Invalid URL format. URL must start with http:// or https://"
msgstr "" msgstr ""
msgid "Invalid subnet format. Use format: X.X.X.X/Y (like 192.168.1.0/24)" msgid "Invalid subnet format. Use format: X.X.X.X/Y (like 103.21.244.0/22)"
msgstr "" msgstr ""
msgid "IP address parts must be between 0 and 255" msgid "IP address parts must be between 0 and 255"

View File

@@ -23,14 +23,15 @@ config main 'main'
option yacd '0' option yacd '0'
option socks5 '0' option socks5 '0'
option exclude_ntp '0' option exclude_ntp '0'
option update_interval ''
config second 'second' config second 'second'
option second_enable '0' option second_enable '0'
option second_mode 'proxy' option second_mode 'proxy'
option second_interface '' option second_interface ''
option second_proxy_string '' option second_proxy_string ''
option domain_service_enabled '0' option second_domain_service_enabled '0'
#list service_list 'youtube' #list second_service_list 'youtube'
option second_custom_domains_list_enabled '0' option second_custom_domains_list_enabled '0'
#list second_custom_domains 'ifconfig.io' #list second_custom_domains 'ifconfig.io'
option second_custom_subnets_list_enabled '0' option second_custom_subnets_list_enabled '0'

View File

@@ -320,17 +320,17 @@ list_update() {
dnsmasq_config_check podkop2-custom-domains.lst dnsmasq_config_check podkop2-custom-domains.lst
fi fi
config_get_bool domain_service_enabled "second" "domain_service_enabled" "0" config_get_bool second_domain_service_enabled "second" "second_domain_service_enabled" "0"
if [ "$domain_service_enabled" -eq 1 ]; then if [ "$second_domain_service_enabled" -eq 1 ]; then
log "Adding a service for podkop2" log "Adding a service for podkop2"
add_set "podkop2_domains" "second" add_set "podkop2_domains" "second"
config_get service_list second "service_list" config_get second_service_list second "second_service_list"
lists_services_download "$service_list" lists_services_download "$second_service_list"
config_list_foreach second second_custom_domains "list_delist_domains" config_list_foreach second second_custom_domains "list_delist_domains"
dnsmasq_config_check podkop2-domains.lst dnsmasq_config_check podkop2-domains.lst
fi fi
if [ "$second_custom_domains_list_enabled" -eq 1 ] || [ "$domain_service_enabled" -eq 1 ]; then if [ "$second_custom_domains_list_enabled" -eq 1 ] || [ "$second_domain_service_enabled" -eq 1 ]; then
/etc/init.d/dnsmasq restart /etc/init.d/dnsmasq restart
fi fi
@@ -399,9 +399,9 @@ add_set() {
"vpn") "vpn")
if ! nft list chain inet PodkopTable mangle | grep -q "ip daddr @"$set_name" meta mark set"; then if ! nft list chain inet PodkopTable mangle | grep -q "ip daddr @"$set_name" meta mark set"; then
if [ "$connect" = "main" ]; then if [ "$connect" = "main" ]; then
nft add rule inet PodkopTable mangle ip daddr @"$set_name" meta mark set 0x105 counter nft add rule inet PodkopTable mangle iifname "br-lan" ip daddr @"$set_name" meta mark set 0x105 counter
elif [ "$connect" = "second" ]; then elif [ "$connect" = "second" ]; then
nft add rule inet PodkopTable mangle ip daddr @"$set_name" meta mark set 0x106 counter nft add rule inet PodkopTable mangle iifname "br-lan" ip daddr @"$set_name" meta mark set 0x106 counter
fi fi
fi fi
;; ;;
@@ -413,18 +413,18 @@ add_set() {
else else
log "Added nft rule tproxy" log "Added nft rule tproxy"
if [ "$connect" = "main" ]; then if [ "$connect" = "main" ]; then
nft add rule inet PodkopTable mangle ip daddr @"$set_name" meta l4proto tcp meta mark set 0x105 counter nft add rule inet PodkopTable mangle iifname "br-lan" ip daddr @"$set_name" meta l4proto tcp meta mark set 0x105 counter
nft add rule inet PodkopTable mangle ip daddr @"$set_name" meta l4proto udp meta mark set 0x105 counter nft add rule inet PodkopTable mangle iifname "br-lan" ip daddr @"$set_name" meta l4proto udp meta mark set 0x105 counter
if ! ( nft list table inet PodkopTable | grep -q "meta mark 0x00000105 meta l4proto tcp tproxy" ); then if ! ( nft list table inet PodkopTable | grep -q "meta mark 0x00000105 meta l4proto tcp tproxy" ); then
nft add rule inet PodkopTable proxy iifname "br-lan" meta mark 0x105 meta l4proto tcp tproxy ip to :1602 counter nft add rule inet PodkopTable proxy meta mark 0x105 meta l4proto tcp tproxy ip to :1602 counter
nft add rule inet PodkopTable proxy iifname "br-lan" meta mark 0x105 meta l4proto udp tproxy ip to :1602 counter nft add rule inet PodkopTable proxy meta mark 0x105 meta l4proto udp tproxy ip to :1602 counter
fi fi
elif [ "$connect" = "second" ]; then elif [ "$connect" = "second" ]; then
nft add rule inet PodkopTable mangle ip daddr @"$set_name" meta l4proto tcp meta mark set 0x106 counter nft add rule inet PodkopTable mangle iifname "br-lan" ip daddr @"$set_name" meta l4proto tcp meta mark set 0x106 counter
nft add rule inet PodkopTable mangle ip daddr @"$set_name" meta l4proto udp meta mark set 0x106 counter nft add rule inet PodkopTable mangle iifname "br-lan" ip daddr @"$set_name" meta l4proto udp meta mark set 0x106 counter
if ! ( nft list table inet PodkopTable | grep -q "meta mark 0x00000106 meta l4proto tcp tproxy" ); then if ! ( nft list table inet PodkopTable | grep -q "meta mark 0x00000106 meta l4proto tcp tproxy" ); then
nft add rule inet PodkopTable proxy iifname "br-lan" meta mark 0x106 meta l4proto tcp tproxy ip to :1603 counter nft add rule inet PodkopTable proxy meta mark 0x106 meta l4proto tcp tproxy ip to :1603 counter
nft add rule inet PodkopTable proxy iifname "br-lan" meta mark 0x106 meta l4proto udp tproxy ip to :1603 counter nft add rule inet PodkopTable proxy meta mark 0x106 meta l4proto udp tproxy ip to :1603 counter
fi fi
fi fi
fi fi
@@ -662,7 +662,7 @@ list_all_traffic_from_ip() {
if ! nft list chain inet PodkopTable mangle | grep -q "ip saddr $ip"; then if ! nft list chain inet PodkopTable mangle | grep -q "ip saddr $ip"; then
config_get mode "main" "mode" "0" config_get mode "main" "mode" "0"
if [ "$mode" = "vpn" ]; then if [ "$mode" = "vpn" ]; then
nft insert rule inet PodkopTable mangle ip saddr $ip meta mark set 0x105 counter nft insert rule inet PodkopTable mangle iifname "br-lan" ip saddr $ip meta mark set 0x105 counter
elif [ "$mode" = "proxy" ]; then elif [ "$mode" = "proxy" ]; then
nft add set inet PodkopTable localv4 { type ipv4_addr\; flags interval\; } nft add set inet PodkopTable localv4 { type ipv4_addr\; flags interval\; }
nft add element inet PodkopTable localv4 { \ nft add element inet PodkopTable localv4 { \
@@ -680,7 +680,7 @@ list_all_traffic_from_ip() {
203.0.113.0/24, \ 203.0.113.0/24, \
224.0.0.0/4, \ 224.0.0.0/4, \
240.0.0.0-255.255.255.255 } 240.0.0.0-255.255.255.255 }
nft insert rule inet PodkopTable mangle ip saddr $ip meta l4proto { tcp, udp } meta mark set 0x105 counter nft insert rule inet PodkopTable mangle iifname "br-lan" ip saddr $ip meta l4proto { tcp, udp } meta mark set 0x105 counter
nft insert rule inet PodkopTable mangle ip saddr $ip ip daddr @localv4 return nft insert rule inet PodkopTable mangle ip saddr $ip ip daddr @localv4 return
fi fi
fi fi