From f7adea50405a26cd92ee43ee1c6d124d1d7bde19 Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Sat, 5 Mar 2022 20:34:24 +0000
Subject: prosodyctl: check turn: improve warning text to suggest issues

---
 util/prosodyctl/check.lua | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/util/prosodyctl/check.lua b/util/prosodyctl/check.lua
index 6f22ab17..7400ba07 100644
--- a/util/prosodyctl/check.lua
+++ b/util/prosodyctl/check.lua
@@ -122,7 +122,7 @@ local function check_turn_service(turn_service, ping_service)
 	local nonce = pre_result:get_attribute("nonce");
 
 	if not realm then
-		table.insert(result.warnings, "TURN server did not return an authentication realm");
+		table.insert(result.warnings, "TURN server did not return an authentication realm. Is authentication enabled?");
 	end
 	if not nonce then
 		table.insert(result.warnings, "TURN server did not return a nonce");
@@ -245,6 +245,10 @@ local function check_turn_service(turn_service, ping_service)
 		return result;
 	end
 
+	if result.external_ip.address ~= result.external_ip_pong.address then
+		table.insert(result.warnings, "TURN external IP vs relay address mismatch! Is the TURN server behind a NAT and misconfigured?");
+	end
+
 	--
 
 	return result;
-- 
cgit v1.2.3