Compare commits

..

4 Commits

Author SHA1 Message Date
Andrey Petelin
aa8f2cef41 feat: Add log_level option in LuCI and use configured value for sing-box logging 2025-12-10 17:58:22 +05:00
Andrey Petelin
96f6def701 fix: lower priority of fully_routed_ips relative to routing_excluded_ips 2025-12-10 16:55:23 +05:00
Kirill Sobakin
0152f073b7 Merge pull request #270 from itdoginfo/fix/267-determine-dhcp-ip
Use network_get_ipaddr to obtain LAN listen IP
2025-12-09 16:40:41 +03:00
Andrey Petelin
06ce944e1c fix: add and source network functions, use network_get_ipaddr to obtain LAN listen IP 2025-12-09 15:15:58 +05:00
4 changed files with 29 additions and 7 deletions

View File

@@ -378,6 +378,24 @@ function createSettingsContent(section) {
return true;
};
o = section.option(
form.ListValue,
"log_level",
_("Log Level"),
_(
"Select the log level for sing-box",
),
);
o.value("trace", "Trace");
o.value("debug", "Debug");
o.value("info", "Info");
o.value("warn", "Warn");
o.value("error", "Error");
o.value("fatal", "Fatal");
o.value("panic", "Panic");
o.default = "warn";
o.rmempty = false;
o = section.option(
form.Flag,
"exclude_ntp",

View File

@@ -16,6 +16,7 @@ config settings 'settings'
option dont_touch_dhcp '0'
option config_path '/etc/sing-box/config.json'
option cache_path '/tmp/sing-box/cache.db'
option log_level 'warn'
option exclude_ntp '0'
option shutdown_correctly '0'
#list routing_excluded_ips '192.168.1.3'

View File

@@ -12,6 +12,7 @@ check_required_file() {
PODKOP_LIB="/usr/lib/podkop"
check_required_file /lib/functions.sh
check_required_file /lib/config/uci.sh
check_required_file /lib/functions/network.sh
check_required_file "$PODKOP_LIB/constants.sh"
check_required_file "$PODKOP_LIB/nft.sh"
check_required_file "$PODKOP_LIB/helpers.sh"
@@ -19,8 +20,9 @@ check_required_file "$PODKOP_LIB/sing_box_config_manager.sh"
check_required_file "$PODKOP_LIB/sing_box_config_facade.sh"
check_required_file "$PODKOP_LIB/logging.sh"
check_required_file "$PODKOP_LIB/rulesets.sh"
. /lib/config/uci.sh
. /lib/functions.sh
. /lib/config/uci.sh
. /lib/functions/network.sh
. "$PODKOP_LIB/constants.sh"
. "$PODKOP_LIB/nft.sh"
. "$PODKOP_LIB/helpers.sh"
@@ -588,7 +590,9 @@ sing_box_init_config() {
sing_box_configure_log() {
log "Configure the log section of a sing-box JSON configuration"
config=$(sing_box_cm_configure_log "$config" false "$SB_DEFAULT_LOG_LEVEL" false)
local log_level
config_get log_level "settings" "log_level"
config=$(sing_box_cm_configure_log "$config" false "$log_level" false)
}
sing_box_configure_inbounds() {
@@ -783,8 +787,6 @@ sing_box_configure_route() {
config=$(sing_box_cf_proxy_domain "$config" "$SB_TPROXY_INBOUND_TAG" "$CHECK_PROXY_IP_DOMAIN" "$first_outbound_tag")
config=$(sing_box_cf_override_domain_port "$config" "$FAKEIP_TEST_DOMAIN" 8443)
config_foreach include_source_ips_in_routing_handler "section"
configure_common_reject_route_rule
local routing_excluded_ips
@@ -795,6 +797,8 @@ sing_box_configure_route() {
config_list_foreach "settings" "routing_excluded_ips" exclude_source_ip_from_routing_handler "$rule_tag"
fi
config_foreach include_source_ips_in_routing_handler "section"
config_foreach configure_routing_for_section_lists "section"
}
@@ -1512,7 +1516,8 @@ get_service_listen_address() {
return 0
fi
service_listen_address="$(uci_get "network" "lan" "ipaddr" | awk '{print $1}' | cut -d'/' -f1)"
local interface="lan"
network_get_ipaddr service_listen_address "$interface"
if [ -z "$service_listen_address" ]; then
log "Failed to determine the listening IP address. Please open an issue to report this problem: https://github.com/itdoginfo/podkop/issues" "error"

View File

@@ -22,8 +22,6 @@ NFT_INTERFACE_SET_NAME="interfaces"
## sing-box
SB_REQUIRED_VERSION="1.12.0"
# Log
SB_DEFAULT_LOG_LEVEL="warn"
# DNS
SB_DNS_SERVER_TAG="dns-server"
SB_FAKEIP_DNS_SERVER_TAG="fakeip-server"