mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Merge pull request #4621 from pi-hole/new/set_rate_limit
Add backend option to set rate-limit from the dashboard
This commit is contained in:
commit
9db19c5e96
1 changed files with 18 additions and 0 deletions
|
@ -808,6 +808,23 @@ RemoveCustomCNAMERecord() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetRateLimit() {
|
||||||
|
local rate_limit_count rate_limit_interval reload
|
||||||
|
rate_limit_count="${args[2]}"
|
||||||
|
rate_limit_interval="${args[3]}"
|
||||||
|
reload="${args[4]}"
|
||||||
|
|
||||||
|
# Set rate-limit setting inf valid
|
||||||
|
if [ "${rate_limit_count}" -ge 0 ] && [ "${rate_limit_interval}" -ge 0 ]; then
|
||||||
|
changeFTLsetting "RATE_LIMIT" "${rate_limit_count}/${rate_limit_interval}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restart FTL to update rate-limit settings only if $reload not false
|
||||||
|
if [[ ! $reload == "false" ]]; then
|
||||||
|
RestartDNS
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
args=("$@")
|
args=("$@")
|
||||||
|
|
||||||
|
@ -841,6 +858,7 @@ main() {
|
||||||
"removecustomdns" ) RemoveCustomDNSAddress;;
|
"removecustomdns" ) RemoveCustomDNSAddress;;
|
||||||
"addcustomcname" ) AddCustomCNAMERecord;;
|
"addcustomcname" ) AddCustomCNAMERecord;;
|
||||||
"removecustomcname" ) RemoveCustomCNAMERecord;;
|
"removecustomcname" ) RemoveCustomCNAMERecord;;
|
||||||
|
"ratelimit" ) SetRateLimit;;
|
||||||
* ) helpFunc;;
|
* ) helpFunc;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue