mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-02-05 07:23:59 +00:00
FailoverApp: minor code refactoring changes done.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Technitium DNS Server
|
||||
Copyright (C) 2022 Shreyas Zare (shreyas@technitium.com)
|
||||
Copyright (C) 2023 Shreyas Zare (shreyas@technitium.com)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -333,9 +333,16 @@ namespace Failover
|
||||
foreach (JsonElement jsonNetwork in jsonUnderMaintenance.EnumerateArray())
|
||||
{
|
||||
string network = jsonNetwork.GetProperty("network").GetString();
|
||||
bool enable = jsonNetwork.GetProperty("enable").GetBoolean();
|
||||
bool enabled;
|
||||
|
||||
_underMaintenance.TryAdd(NetworkAddress.Parse(network), enable);
|
||||
if (jsonNetwork.TryGetProperty("enabled", out JsonElement jsonEnabled))
|
||||
enabled = jsonEnabled.GetBoolean();
|
||||
else if (jsonNetwork.TryGetProperty("enable", out JsonElement jsonEnable))
|
||||
enabled = jsonEnable.GetBoolean();
|
||||
else
|
||||
enabled = true;
|
||||
|
||||
_underMaintenance.TryAdd(NetworkAddress.Parse(network), enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +89,11 @@
|
||||
"underMaintenance": [
|
||||
{
|
||||
"network": "192.168.10.2/32",
|
||||
"enable": false
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"network": "10.1.1.0/24",
|
||||
"enable": false
|
||||
"enabled": false
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user