mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 03:26:51 +03:00
refactor: rename all_traffic_ip to fully_routed_ips, remove all_traffic_from_ip_enabled flag, update handlers
This commit is contained in:
@@ -534,25 +534,13 @@ function createSectionContent(section) {
|
||||
return validation.message;
|
||||
};
|
||||
|
||||
o = section.option(
|
||||
form.Flag,
|
||||
'all_traffic_from_ip_enabled',
|
||||
_('IP for full redirection'),
|
||||
_(
|
||||
'Specify local IP addresses whose traffic will always use the configured route',
|
||||
),
|
||||
);
|
||||
o.default = '0';
|
||||
o.rmempty = false;
|
||||
|
||||
o = section.option(
|
||||
form.DynamicList,
|
||||
'all_traffic_ip',
|
||||
_('Local IPs'),
|
||||
_('Enter valid IPv4 addresses'),
|
||||
'fully_routed_ips',
|
||||
_('Fully Routed IPs'),
|
||||
_('Specify local IP addresses whose traffic will always be routed through the configured route'),
|
||||
);
|
||||
o.placeholder = 'IP';
|
||||
o.depends('all_traffic_from_ip_enabled', '1');
|
||||
o.rmempty = false;
|
||||
o.validate = function (section_id, value) {
|
||||
// Optional
|
||||
@@ -573,7 +561,7 @@ function createSectionContent(section) {
|
||||
form.Flag,
|
||||
'mixed_proxy_enabled',
|
||||
_('Enable Mixed Proxy'),
|
||||
_('Enable the mixed proxy, allowing this section to route traffic through both HTTP and SOCKS proxies.'),
|
||||
_('Enable the mixed proxy, allowing this section to route traffic through both HTTP and SOCKS proxies'),
|
||||
);
|
||||
o.default = '0';
|
||||
o.rmempty = false;
|
||||
@@ -584,7 +572,7 @@ function createSectionContent(section) {
|
||||
_('Mixed Proxy Port'),
|
||||
_(
|
||||
'Specify the port number on which the mixed proxy will run for this section. ' +
|
||||
'Make sure the selected port is not used by another service.'
|
||||
'Make sure the selected port is not used by another service'
|
||||
),
|
||||
);
|
||||
o.rmempty = false;
|
||||
|
||||
@@ -754,15 +754,15 @@ sing_box_configure_route() {
|
||||
include_source_ips_in_routing_handler() {
|
||||
local section="$1"
|
||||
|
||||
local all_traffic_from_ip_enabled rule_tag
|
||||
config_get all_traffic_from_ip_enabled "$section" "all_traffic_from_ip_enabled" 0
|
||||
if [ "$all_traffic_from_ip_enabled" -eq 1 ]; then
|
||||
local fully_routed_ips rule_tag
|
||||
config_get fully_routed_ips "$section" "fully_routed_ips"
|
||||
if [ -n "$fully_routed_ips" ]; then
|
||||
rule_tag="$(gen_id)"
|
||||
config=$(
|
||||
sing_box_cm_add_route_rule \
|
||||
"$config" "$rule_tag" "$SB_TPROXY_INBOUND_TAG" "$(get_outbound_tag_by_section "$section")"
|
||||
)
|
||||
config_list_foreach "$section" "all_traffic_ip" include_source_ip_in_routing_handler "$rule_tag"
|
||||
config_list_foreach "$section" "fully_routed_ips" include_source_ip_in_routing_handler "$rule_tag"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user