routeros-scripts-phg/helperFunctions.rsc

25 lines
700 B
Plaintext
Raw Permalink Normal View History

# -------------------------------------------------------------------------------
# Helper functions
#
# by Philip 'ShokiNN' Henning <mail@philip-henning.com>
# RouterOS compatibility: 7+
# Version 1.0
# last update: 20.01.2025
# License: MIT
# -------------------------------------------------------------------------------
# ---------------------------
# Function: safelyResolve
# - Takes an DNS string (e.g. "example.com")
# - Takes an IP type [ipv4, ipv6]
# - Returns a string of and IP address
# ---------------------------
:global safelyResolve do={
:do {
:local ip [:resolve domain-name="$1" type=$2];
:return "$ip";
} on-error={
return "";
};
};