diff --git a/podkop/files/usr/bin/podkop b/podkop/files/usr/bin/podkop index a718faa..722a218 100755 --- a/podkop/files/usr/bin/podkop +++ b/podkop/files/usr/bin/podkop @@ -38,43 +38,43 @@ check_requirements() { coreutils_base64_version="$(base64 --version | head -n1 | awk '{print $4}')" if [ -z "$sing_box_version" ]; then - log "Package 'sing-box' is not installed." "error" + log "Package 'sing-box' is not installed. Aborted." "error" exit 1 else if ! is_min_package_version "$sing_box_version" "$SB_REQUIRED_VERSION"; then - log "Package 'sing-box' version ($sing_box_version) is lower than the required minimum ($SB_REQUIRED_VERSION). Update sing-box: opkg update && opkg remove sing-box && opkg install sing-box" "error" + log "Package 'sing-box' version ($sing_box_version) is lower than the required minimum ($SB_REQUIRED_VERSION). Update sing-box: opkg update && opkg remove sing-box && opkg install sing-box. Aborted." "error" exit 1 fi if ! service_exists "sing-box"; then - log "Service 'sing-box' is missing. Please install the official package to ensure the service is available." "error" + log "Service 'sing-box' is missing. Please install the official package to ensure the service is available. Aborted." "error" exit 1 fi fi if [ -z "$jq_version" ]; then - log "Package 'jq' is not installed." "error" + log "Package 'jq' is not installed. Aborted." "error" exit 1 elif ! is_min_package_version "$jq_version" "$JQ_REQUIRED_VERSION"; then - log "Package 'jq' version ($jq_version) is lower than the required minimum ($JQ_REQUIRED_VERSION)." "error" + log "Package 'jq' version ($jq_version) is lower than the required minimum ($JQ_REQUIRED_VERSION). Aborted." "error" exit 1 fi if [ -z "$coreutils_base64_version" ]; then - log "Package 'coreutils-base64' is not installed." "error" + log "Package 'coreutils-base64' is not installed. Aborted." "error" exit 1 elif ! is_min_package_version "$coreutils_base64_version" "$COREUTILS_BASE64_REQUIRED_VERSION"; then log "Package 'coreutils-base64' version ($coreutils_base64_version) is lower than the required minimum ($COREUTILS_BASE64_REQUIRED_VERSION). This may cause issues when decoding base64 streams with missing padding, as automatic padding support is not available in older versions." "warn" fi if grep -qE 'doh_backup_noresolv|doh_backup_server|doh_server' /etc/config/dhcp; then - log "Detected https-dns-proxy in dhcp config. Edit /etc/config/dhcp" "warn" + log "Detected https-dns-proxy in DHCP config. Edit /etc/config/dhcp" "error" fi if has_outbound_section; then log "Outbound section found" "debug" else - log "Outbound section not found. Please check your configuration file (missing proxy_string, interface, outbound_json, or urltest_proxy_links). Aborted." "fatal" + log "Outbound section not found. Please check your configuration file (missing proxy_string, interface, outbound_json, or urltest_proxy_links). Aborted." "error" exit 1 fi } @@ -254,17 +254,17 @@ route_table_rule_mark() { grep -q "105 $table" /etc/iproute2/rt_tables || echo "105 $table" >> /etc/iproute2/rt_tables if ! ip route list table $table | grep -q "local default dev lo scope host"; then - log "Added route for tproxy" + log "Added route for tproxy" "debug" ip route add local 0.0.0.0/0 dev lo table $table else - log "Route for tproxy exists" + log "Route for tproxy exists" "debug" fi if ! ip rule list | grep -q "from all fwmark 0x105 lookup $table"; then - log "Create marking rule" + log "Create marking rule" "debug" ip -4 rule add fwmark 0x105 table $table priority 105 else - log "Marking rule exist" + log "Marking rule exist" "debug" fi } @@ -911,7 +911,7 @@ prepare_common_ruleset() { config=$(sing_box_cm_patch_dns_route_rule "$config" "$SB_FAKEIP_DNS_RULE_TAG" "rule_set" "$ruleset_tag") ;; subnets) ;; - *) log "Unsupported remote rule set type: $type" "warn" ;; + *) log "Unsupported remote rule set type: $type" "error" ;; esac fi } @@ -995,7 +995,7 @@ configure_local_domain_or_subnet_lists() { config_list_foreach "$section" "local_subnet_lists" import_local_domain_or_subnet_list "$type" \ "$section" "$ruleset_filepath" ;; - *) log "Unsupported local rule set type: $type" "warn" ;; + *) log "Unsupported local rule set type: $type" "error" ;; esac } @@ -1006,7 +1006,7 @@ import_local_domain_or_subnet_list() { local ruleset_filepath="$4" if ! file_exists "$filepath"; then - log "File $filepath not found" "warn" + log "File $filepath not found" "error" return 1 fi @@ -1014,7 +1014,7 @@ import_local_domain_or_subnet_list() { items="$(parse_domain_or_subnet_file_to_comma_string "$filepath" "$type")" if [ -z "$items" ]; then - log "No valid $type found in $filepath" + log "No valid $type found in $filepath" "warn" return 0 fi @@ -1053,7 +1053,7 @@ configure_remote_domain_or_subnet_list_handler() { config=$(sing_box_cm_patch_dns_route_rule "$config" "$SB_FAKEIP_DNS_RULE_TAG" "rule_set" "$ruleset_tag") ;; subnets) ;; - *) log "Unsupported remote rule set type: $type" "warn" ;; + *) log "Unsupported remote rule set type: $type" "error" ;; esac ;; *) @@ -1152,7 +1152,7 @@ sing_box_config_check() { local config_path="$1" if ! sing-box -c "$config_path" check > /dev/null 2>&1; then - log "Sing-box configuration $config_path is invalid" "fatal" + log "Sing-box configuration $config_path is invalid. Aborted." "fatal" exit 1 fi } @@ -1308,7 +1308,7 @@ import_domains_or_subnets_from_remote_file() { rm -f "$tmpfile" if [ -z "$items" ]; then - log "No valid $type found in $url" + log "No valid $type found in $url" "warn" return 0 fi diff --git a/podkop/files/usr/lib/helpers.sh b/podkop/files/usr/lib/helpers.sh index a8d035a..7af83f2 100644 --- a/podkop/files/usr/lib/helpers.sh +++ b/podkop/files/usr/lib/helpers.sh @@ -128,7 +128,7 @@ get_ruleset_format_by_file_extension() { json) format="source" ;; srs) format="binary" ;; *) - log "Unsupported file extension: .$file_extension" + log "Unsupported file extension: .$file_extension" "error" return 1 ;; esac diff --git a/podkop/files/usr/lib/sing_box_config_facade.sh b/podkop/files/usr/lib/sing_box_config_facade.sh index bdff029..1c3fb04 100644 --- a/podkop/files/usr/lib/sing_box_config_facade.sh +++ b/podkop/files/usr/lib/sing_box_config_facade.sh @@ -34,7 +34,7 @@ sing_box_cf_add_dns_server() { "$domain_resolver" "$detour") ;; *) - log "Unsupported DNS server type: $type" + log "Unsupported DNS server type: $type. Aborted." "fatal" exit 1 ;; esac @@ -121,7 +121,7 @@ sing_box_cf_add_proxy_outbound() { config=$(_add_outbound_transport "$config" "$tag" "$url") ;; *) - log "Unsupported proxy $scheme type" + log "Unsupported proxy $scheme type. Aborted." "fatal" exit 1 ;; esac