trace=yes
dont-query=
local-address=127.0.0.1
-packetcache-ttl=0
-packetcache-servfail-ttl=0
+packetcache-ttl=15
+packetcache-servfail-ttl=15
max-cache-ttl=15
-threads=1
+threads=2
loglevel=9
disable-syslog=yes
log-common-errors=yes
statistics-interval=0
+"""
+ _config_template_yaml_default = """
+recursor:
+ daemon: false
+ threads: 2
+ include_dir: %s
+recordcache:
+ max_ttl: 15
+incoming:
+ listen:
+ - 127.0.0.1
+packetcache:
+ ttl: 15
+ servfail_ttl: 15
+outgoing:
+ dont_query: []
+logging:
+ trace: true
+ disable_syslog: true
+ common_errors: true
+ loglevel: 9
+ statistics_interval: 0
"""
_config_template = """
"""
roothints.write(cls._roothints)
conf.write("hint-file=%s\n" % roothintspath)
+ @classmethod
+ def generateRecursorYamlConfig(cls, confdir):
+ params = tuple([getattr(cls, param) for param in cls._config_params])
+ if len(params):
+ print(params)
+
+ recursorconf = os.path.join(confdir, 'recursor.yml')
+
+ with open(recursorconf, 'w') as conf:
+ conf.write("# Autogenerated by recursortests.py\n")
+ conf.write(cls._config_template_yaml_default % confdir)
+ recursorconf = os.path.join(confdir, 'recursor01.yml')
+ with open(recursorconf, 'w') as conf:
+ conf.write(cls._config_template % params)
+ conf.write("\n")
+ recursorconf = os.path.join(confdir, 'recursor02.yml')
+ with open(recursorconf, 'w') as conf:
+ conf.write("recursor:\n")
+ conf.write(" socket_dir: %s\n" % confdir)
+ if cls._lua_config_file or cls._root_DS:
+ luaconfpath = os.path.join(confdir, 'conffile.lua')
+ with open(luaconfpath, 'w') as luaconf:
+ if cls._root_DS:
+ luaconf.write("addTA('.', '%s')\n" % cls._root_DS)
+ if cls._lua_config_file:
+ luaconf.write(cls._lua_config_file)
+ conf.write(" lua_config_file: %s\n" % luaconfpath)
+ if cls._lua_dns_script_file:
+ luascriptpath = os.path.join(confdir, 'dnsscript.lua')
+ with open(luascriptpath, 'w') as luascript:
+ luascript.write(cls._lua_dns_script_file)
+ conf.write(" lua_dns_script: %s\n" % luascriptpath)
+ if cls._roothints:
+ roothintspath = os.path.join(confdir, 'root.hints')
+ with open(roothintspath, 'w') as roothints:
+ roothints.write(cls._roothints)
+ conf.write(" hint_file: %s\n" % roothintspath)
+
@classmethod
def startResponders(cls):
pass