summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/net.inc9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/net.inc b/modules/net.inc
new file mode 100644
index 0000000..e7c9dfc
--- /dev/null
+++ b/modules/net.inc
@@ -0,0 +1,9 @@
+#!/bin/ash
+
+net_resolve_v4() {
+ if command -v dig &> /dev/null; then
+ printf "%s " $( busybox timeout -t 2 dig +short "$1" | grep -E '^[0-9.]+$' )
+ elif command -v nslookup &> /dev/null; then
+ printf "%s " $( LC_ALL=C busybox timeout -t 2 nslookup "$1" 2>/dev/null | grep -A 4 '^Name:' | grep -E '^Address\s*[0-9]*: ' | awk -F': ' '{print $2}' | grep -oE '^[0-9]+\.[0-9.]+(\s|$)' )
+ fi
+}