diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js index 585771d..77067ac 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js @@ -104,6 +104,43 @@ function createSectionContent(section) { return validation.message; }; + o = section.option( + form.ListValue, + "urltest_check_interval", + _("URLTest Check Interval"), + _("The interval between connectivity tests") + ); + o.value("30s", _("Every 30 seconds")); + o.value("1m", _("Every 1 minute")); + o.value("3m", _("Every 3 minutes")); + o.value("5m", _("Every 5 minutes")); + o.default = "3m" + o.depends("proxy_config_type", "urltest"); + + o = section.option( + form.Value, + "urltest_tolerance", + _("URLTest Tolerance"), + _("The maximum difference in response times (ms) allowed when comparing servers") + ); + o.default = "50" + o.rmempty = false; + o.depends("proxy_config_type", "urltest"); + + o = section.option( + form.Value, + "urltest_testing_url", + _("URLTest Testing URL"), + _("The URL used to test server connectivity") + ); + o.value("https://www.gstatic.com/generate_204", "https://www.gstatic.com/generate_204 (Google)"); + o.value("https://cp.cloudflare.com/generate_204", "https://cp.cloudflare.com/generate_204 (Cloudflare)"); + o.value("https://captive.apple.com", "https://captive.apple.com (Apple)"); + o.value("https://connectivity-check.ubuntu.com", " https://connectivity-check.ubuntu.com (Ubuntu)") + o.default = "https://www.gstatic.com/generate_204" + o.rmempty = false; + o.depends("proxy_config_type", "urltest"); + o = section.option( form.Flag, "enable_udp_over_tcp", diff --git a/podkop/files/usr/bin/podkop b/podkop/files/usr/bin/podkop index 9f2bd07..2ef9a9e 100755 --- a/podkop/files/usr/bin/podkop +++ b/podkop/files/usr/bin/podkop @@ -627,9 +627,12 @@ configure_outbound_handler() { urltest) log "Detected proxy configuration type: urltest" "debug" local urltest_proxy_links udp_over_tcp i urltest_tag selector_tag outbound_tag outbound_tags \ - urltest_outbounds selector_outbounds + urltest_outbounds selector_outbounds urltest_check_interval urltest_tolerance urltest_testing_url config_get urltest_proxy_links "$section" "urltest_proxy_links" config_get udp_over_tcp "$section" "enable_udp_over_tcp" + config_get urltest_check_interval "$section" "urltest_check_interval" "3m" + config_get urltest_tolerance "$section" "urltest_tolerance" 50 + config_get urltest_testing_url "$section" "urltest_testing_url" "https://www.gstatic.com/generate_204" if [ -z "$urltest_proxy_links" ]; then log "URLTest proxy links is not set. Aborted." "fatal" @@ -652,7 +655,8 @@ configure_outbound_handler() { selector_tag="$(get_outbound_tag_by_section "$section")" urltest_outbounds="$(comma_string_to_json_array "$outbound_tags")" selector_outbounds="$(comma_string_to_json_array "$outbound_tags,$urltest_tag")" - config="$(sing_box_cm_add_urltest_outbound "$config" "$urltest_tag" "$urltest_outbounds")" + config="$(sing_box_cm_add_urltest_outbound "$config" "$urltest_tag" "$urltest_outbounds" \ + "$urltest_testing_url" "$urltest_check_interval" "$urltest_tolerance")" config="$(sing_box_cm_add_selector_outbound "$config" "$selector_tag" "$selector_outbounds" "$urltest_tag")" ;; *)