mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-10-07 08:00:48 +00:00
This is fairly big diff because a number of hickory types moved around or changed signature. In particular, the config structs changed in a way that would fan out and require attention by our users. So the approach I opted to take here was to define our own types that look like the hickory 0.25 shape and then we have explicit logic to map those to hickory and also to our unbound resolver crate. This commit also bumps up the unbound resolver crate because it also uses hickory's types. I took the opportunity to upgrade the version of the embedded unbound resolver as part of that work.
73 lines
1.6 KiB
Lua
73 lines
1.6 KiB
Lua
local kumo = require 'kumo'
|
|
|
|
-- This file exercises the various resolver setup functions
|
|
-- with a variety of configurations
|
|
|
|
-- Explicitly use hickory with the system resolver.
|
|
-- This is the default configuration and doesn't need
|
|
-- to be made explicit in your config
|
|
kumo.dns.configure_resolver 'HickorySystemConfig'
|
|
|
|
-- Use hickory with custom upstream dns
|
|
kumo.dns.configure_resolver {
|
|
Hickory = {
|
|
name_servers = {
|
|
'10.0.0.1:53',
|
|
},
|
|
},
|
|
}
|
|
|
|
-- Use hickory with the detailed name-server form, exercising each
|
|
-- accepted value of `protocol` and a custom bind address.
|
|
kumo.dns.configure_resolver {
|
|
Hickory = {
|
|
name_servers = {
|
|
{ socket_addr = '10.0.0.1:53', protocol = 'udp' },
|
|
{ socket_addr = '10.0.0.1:53', protocol = 'tcp' },
|
|
{
|
|
socket_addr = '10.0.0.2:53',
|
|
protocol = 'udp_then_tcp',
|
|
trust_negative_responses = false,
|
|
bind_addr = '0.0.0.0:0',
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
-- Use Unbound with custom upstream dns
|
|
kumo.dns.configure_resolver {
|
|
Unbound = {
|
|
name_servers = {
|
|
'10.0.0.1:53',
|
|
},
|
|
},
|
|
}
|
|
|
|
-- Use a test resolver with a static, explicitly limited configuration
|
|
kumo.dns.configure_resolver {
|
|
Test = {
|
|
zones = {
|
|
[[
|
|
$ORIGIN 0.0.127.in-addr.arpa.
|
|
1 30 IN PTR localhost.
|
|
]],
|
|
},
|
|
},
|
|
}
|
|
|
|
-- Aggregate a test resolver with the system resolver; the test
|
|
-- resolver takes precedence over the system resolver.
|
|
kumo.dns.configure_resolver {
|
|
Aggregate = {
|
|
Test = {
|
|
zones = {
|
|
[[
|
|
$ORIGIN 0.0.127.in-addr.arpa.
|
|
1 30 IN PTR localhost.
|
|
]],
|
|
},
|
|
},
|
|
'HickorySystemConfig',
|
|
},
|
|
}
|