mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-14 20:14:29 +02:00
netwatch-dns: handle status 'up' only
This commit is contained in:
parent
f416b0e59d
commit
007d1ff7b8
1 changed files with 4 additions and 5 deletions
|
@ -26,11 +26,11 @@ $ScriptLock $0;
|
||||||
:local DnsFallback ({});
|
:local DnsFallback ({});
|
||||||
:local DnsCurrent [ /ip/dns/get servers ];
|
:local DnsCurrent [ /ip/dns/get servers ];
|
||||||
|
|
||||||
:foreach Host in=[ /tool/netwatch/find where comment~"dns" !disabled ] do={
|
:foreach Host in=[ /tool/netwatch/find where comment~"dns" status="up" ] do={
|
||||||
:local HostVal [ /tool/netwatch/get $Host ];
|
:local HostVal [ /tool/netwatch/get $Host ];
|
||||||
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
|
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
|
||||||
|
|
||||||
:if ($HostVal->"status" = "up" && $HostInfo->"disabled" != true) do={
|
:if ($HostInfo->"disabled" != true) do={
|
||||||
:if ($HostInfo->"dns" = true) do={
|
:if ($HostInfo->"dns" = true) do={
|
||||||
:set DnsServers ($DnsServers, $HostVal->"host");
|
:set DnsServers ($DnsServers, $HostVal->"host");
|
||||||
}
|
}
|
||||||
|
@ -61,12 +61,11 @@ $ScriptLock $0;
|
||||||
:local DohCurrent [ /ip/dns/get use-doh-server ];
|
:local DohCurrent [ /ip/dns/get use-doh-server ];
|
||||||
:local DohCert "";
|
:local DohCert "";
|
||||||
|
|
||||||
:foreach Host in=[ /tool/netwatch/find where comment~"doh" !disabled ] do={
|
:foreach Host in=[ /tool/netwatch/find where comment~"doh" status="up" ] do={
|
||||||
:local HostVal [ /tool/netwatch/get $Host ];
|
:local HostVal [ /tool/netwatch/get $Host ];
|
||||||
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
|
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
|
||||||
|
|
||||||
:if ($HostVal->"status" = "up" && $HostInfo->"doh" = true && \
|
:if ($HostInfo->"doh" = true && $HostInfo->"disabled" != true && $DohServer = "") do={
|
||||||
$HostInfo->"disabled" != true && $DohServer = "") do={
|
|
||||||
:set DohServer [ $EitherOr ($HostInfo->"doh-url") \
|
:set DohServer [ $EitherOr ($HostInfo->"doh-url") \
|
||||||
("https://" . $HostVal->"host" . "/dns-query") ];
|
("https://" . $HostVal->"host" . "/dns-query") ];
|
||||||
:set DohCert ($HostInfo->"doh-cert");
|
:set DohCert ($HostInfo->"doh-cert");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue