mod_s2s: Add setting for overriding DNS resolvers (and avoid reading /etc/resolv.conf every time)
authorKim Alvefur <zash@zash.se>
Sun, 03 Jun 2018 00:57:51 +0200
changeset 8899 739deb514140
parent 8898 d00ea07de9a0
child 8905 ac21f13798ae
mod_s2s: Add setting for overriding DNS resolvers (and avoid reading /etc/resolv.conf every time)
plugins/mod_s2s/s2sout.lib.lua
--- a/plugins/mod_s2s/s2sout.lib.lua	Fri Jun 08 23:03:34 2018 +0200
+++ b/plugins/mod_s2s/s2sout.lib.lua	Sun Jun 03 00:57:51 2018 +0200
@@ -31,6 +31,7 @@
 
 local dns_timeout = module:get_option_number("dns_timeout", 15);
 dns.settimeout(dns_timeout);
+local resolvers = module:get_option_set("s2s_dns_resolvers")
 
 local s2sout = {};
 
@@ -50,6 +51,11 @@
 	host_session.version = 1;
 
 	host_session.resolver = adns.resolver();
+	if resolvers then
+		for resolver in resolvers do
+			host_session.resolver._resolver:addnameserver(resolver);
+		end
+	end
 
 	-- Kick the connection attempting machine into life
 	if not s2sout.attempt_connection(host_session) then