mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-07 20:16:53 +03:00
feat(podkop): add DNS Rewrite TTL configuration option
This commit is contained in:
@@ -697,6 +697,24 @@ return view.extend({
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
o = s.taboption('additional', form.Value, 'dns_rewrite_ttl', 'DNS Rewrite TTL', 'Time in seconds for DNS record caching (default: 600)');
|
||||||
|
o.default = '600';
|
||||||
|
o.rmempty = false;
|
||||||
|
o.ucisection = 'main';
|
||||||
|
|
||||||
|
o.validate = function (section_id, value) {
|
||||||
|
if (!value) {
|
||||||
|
return 'TTL value cannot be empty';
|
||||||
|
}
|
||||||
|
|
||||||
|
const ttl = parseInt(value);
|
||||||
|
if (isNaN(ttl) || ttl < 0) {
|
||||||
|
return 'TTL must be a positive number';
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
o = s.taboption('additional', form.Value, 'cache_file', 'Cache File Path', 'Select or enter path for sing-box cache file');
|
o = s.taboption('additional', form.Value, 'cache_file', 'Cache File Path', 'Select or enter path for sing-box cache file');
|
||||||
o.value('/tmp/cache.db', 'RAM (/tmp/cache.db)');
|
o.value('/tmp/cache.db', 'RAM (/tmp/cache.db)');
|
||||||
o.value('/usr/share/sing-box/cache.db', 'Flash (/usr/share/sing-box/cache.db)');
|
o.value('/usr/share/sing-box/cache.db', 'Flash (/usr/share/sing-box/cache.db)');
|
||||||
|
|||||||
@@ -709,8 +709,13 @@ sing_box_dns() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sing_box_dns_rule_fakeip() {
|
sing_box_dns_rule_fakeip() {
|
||||||
log "Configure fakeip route in sing-box"
|
local rewrite_ttl
|
||||||
|
config_get rewrite_ttl "main" "dns_rewrite_ttl" "600"
|
||||||
|
|
||||||
|
log "Configure fakeip route in sing-box and set TTL to $rewrite_ttl seconds"
|
||||||
|
|
||||||
jq \
|
jq \
|
||||||
|
--arg ttl "$rewrite_ttl" \
|
||||||
'.dns += {
|
'.dns += {
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
@@ -727,6 +732,8 @@ sing_box_dns_rule_fakeip() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"server": "fakeip-server",
|
"server": "fakeip-server",
|
||||||
|
"domain": "",
|
||||||
|
"rewrite_ttl": ($ttl | tonumber),
|
||||||
"rule_set": []
|
"rule_set": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -1854,10 +1861,8 @@ sing_box_add_secure_dns_probe_domain() {
|
|||||||
--arg override "$override_address" \
|
--arg override "$override_address" \
|
||||||
'.dns.rules |= map(
|
'.dns.rules |= map(
|
||||||
if .server == "fakeip-server" then
|
if .server == "fakeip-server" then
|
||||||
{
|
. + {
|
||||||
"server": .server,
|
"domain": $domain
|
||||||
"domain": $domain,
|
|
||||||
"rule_set": .rule_set
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
.
|
.
|
||||||
|
|||||||
Reference in New Issue
Block a user