From 81661cc8deaacbff3497f0c9ef2625e98257ef76 Mon Sep 17 00:00:00 2001 From: radhitya Date: Sun, 21 Jun 2026 13:11:55 +0700 Subject: dot, readme --- internal/config/config.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'internal/config/config.go') diff --git a/internal/config/config.go b/internal/config/config.go index b2c88ee..42af236 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -15,14 +15,20 @@ type Config struct { Admin AdminConfig `toml:"admin"` ACL ACLConfig `toml:"acl"` Log LogConfig `toml:"log"` + TLS TLSConfig `toml:"tls"` } type ServerConfig struct { ListenUDP string `toml:"listen_udp"` ListenTCP string `toml:"listen_tcp"` ListenDOH string `toml:"listen_doh"` + ListenDoT string `toml:"listen_dot"` } +type TLSConfig struct { + Cert string `toml:"cert"` + Key string `toml:"key"` +} type CacheConfig struct { MaxEntries int `toml:"max_entries"` DBPath string `toml:"db_path"` @@ -164,6 +170,15 @@ func Merge(dst, src Config) Config { if src.Admin.Listen != "" { dst.Admin.Listen = src.Admin.Listen } + if src.Server.ListenDoT != "" { + dst.Server.ListenDoT = src.Server.ListenDoT + } + if src.TLS.Cert != "" { + dst.TLS.Cert = src.TLS.Cert + } + if src.TLS.Key != "" { + dst.TLS.Key = src.TLS.Key + } return dst } @@ -202,5 +217,8 @@ func (c Config) Validate() error { if c.Resolver.Mode == "forward" && len(c.Resolver.Forwarders) == 0 { return fmt.Errorf("resolver mode=forward requires at least one forwarder") } + if c.Server.ListenDoT != "" && (c.TLS.Cert == "" || c.TLS.Key == "") { + return fmt.Errorf("listen_dot requires tls.cert and tls.key") + } return nil } -- cgit v1.2.3