util/prosodyctl/check.lua
changeset 11655 c9f46d28ed7e
parent 11649 3be346c5b940
child 11656 887d7b15e21b
equal deleted inserted replaced
11654:a227bc35771e 11655:c9f46d28ed7e
   469 				else
   469 				else
   470 					print("    proxy65_address for "..host.." should be set to a string, unable to perform DNS check");
   470 					print("    proxy65_address for "..host.." should be set to a string, unable to perform DNS check");
   471 				end
   471 				end
   472 			end
   472 			end
   473 
   473 
       
   474 			local use_ipv4 = configmanager.get("*", "use_ipv4") ~= false;
       
   475 			local use_ipv6 = configmanager.get("*", "use_ipv6") ~= false;
   474 			for target_host in target_hosts do
   476 			for target_host in target_hosts do
   475 				local host_ok_v4, host_ok_v6;
   477 				local host_ok_v4, host_ok_v6;
   476 				do
   478 				do
   477 					local res = dns.lookup(idna.to_ascii(target_host), "A");
   479 					local res = dns.lookup(idna.to_ascii(target_host), "A");
   478 					if res then
   480 					if res then
   509 						end
   511 						end
   510 					end
   512 					end
   511 				end
   513 				end
   512 
   514 
   513 				local bad_protos = {}
   515 				local bad_protos = {}
   514 				if not host_ok_v4 then
   516 				if use_ipv4 and not host_ok_v4 then
   515 					table.insert(bad_protos, "IPv4");
   517 					table.insert(bad_protos, "IPv4");
   516 				end
   518 				end
   517 				if not host_ok_v6 then
   519 				if use_ipv6 and not host_ok_v6 then
   518 					table.insert(bad_protos, "IPv6");
   520 					table.insert(bad_protos, "IPv6");
   519 				end
   521 				end
   520 				if #bad_protos > 0 then
   522 				if #bad_protos > 0 then
   521 					print("    Host "..target_host.." does not seem to resolve to this server ("..table.concat(bad_protos, "/")..")");
   523 					print("    Host "..target_host.." does not seem to resolve to this server ("..table.concat(bad_protos, "/")..")");
   522 				end
   524 				end