No longer hardcode localhost as bandwidth exception, instead auto-config local network exceptions when no exceptions are configured yet
This commit is contained in:
parent
c6078afc24
commit
fb6af1c99e
2 changed files with 8 additions and 15 deletions
|
@ -169,21 +169,6 @@ void Controller::updateBandwidthConfig(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Localhost is always excepted from counts
|
|
||||||
{
|
|
||||||
std::string newbins = Socket::getBinForms("::1");
|
|
||||||
if (offset + newbins.size() < 1700){
|
|
||||||
memcpy(noBWCountMatches + offset, newbins.data(), newbins.size());
|
|
||||||
offset += newbins.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::string newbins = Socket::getBinForms("127.0.0.1/8");
|
|
||||||
if (offset + newbins.size() < 1700){
|
|
||||||
memcpy(noBWCountMatches + offset, newbins.data(), newbins.size());
|
|
||||||
offset += newbins.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is ran whenever a stream becomes active.
|
/// This function is ran whenever a stream becomes active.
|
||||||
|
|
|
@ -395,6 +395,14 @@ namespace Controller{
|
||||||
if (!Controller::Storage["config"].isMember("tknMode")){
|
if (!Controller::Storage["config"].isMember("tknMode")){
|
||||||
Controller::Storage["config"]["tknMode"] = SESS_TKN_DEFAULT_MODE;
|
Controller::Storage["config"]["tknMode"] = SESS_TKN_DEFAULT_MODE;
|
||||||
}
|
}
|
||||||
|
if (!Controller::Storage.isMember("bandwidth") || !Controller::Storage["bandwidth"].isMember("exceptions") || !Controller::Storage["bandwidth"]["exceptions"].size()){
|
||||||
|
Controller::Log("CONF", "Adding default bandwidth exception ranges (local networks) because nothing is configured");
|
||||||
|
Controller::Storage["bandwidth"]["exceptions"].append("::1");
|
||||||
|
Controller::Storage["bandwidth"]["exceptions"].append("127.0.0.0/8");
|
||||||
|
Controller::Storage["bandwidth"]["exceptions"].append("10.0.0.0/8");
|
||||||
|
Controller::Storage["bandwidth"]["exceptions"].append("192.168.0.0/16");
|
||||||
|
Controller::Storage["bandwidth"]["exceptions"].append("172.16.0.0/12");
|
||||||
|
}
|
||||||
Controller::prometheus = Controller::Storage["config"]["prometheus"].asStringRef();
|
Controller::prometheus = Controller::Storage["config"]["prometheus"].asStringRef();
|
||||||
Controller::accesslog = Controller::Storage["config"]["accesslog"].asStringRef();
|
Controller::accesslog = Controller::Storage["config"]["accesslog"].asStringRef();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue