From 40a8bf5766ce4ebca9edaf38c53cadff0451f559 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 3 Jun 2018 00:57:51 +0200 Subject: mod_s2s: Add setting for overriding DNS resolvers (and avoid reading /etc/resolv.conf every time) --- plugins/mod_s2s/s2sout.lib.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/mod_s2s/s2sout.lib.lua') diff --git a/plugins/mod_s2s/s2sout.lib.lua b/plugins/mod_s2s/s2sout.lib.lua index 1225078f..a13eb8c9 100644 --- a/plugins/mod_s2s/s2sout.lib.lua +++ b/plugins/mod_s2s/s2sout.lib.lua @@ -31,6 +31,7 @@ local has_ipv4, has_ipv6; 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 @@ function s2sout.initiate_connection(host_session) 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 -- cgit v1.2.3