@@ -27,15 +27,13 @@ const (
2727)
2828
2929type Config struct {
30- LogLevel int `toml:"log_level"`
31- LogFile * string `toml:"log_file"`
32- UseSyslog bool `toml:"use_syslog"`
33- ServerNames []string `toml:"server_names"`
34- DisabledServerNames []string `toml:"disabled_server_names"`
35- ListenAddresses []string `toml:"listen_addresses"`
36- LocalDoHListenAddresses []string `toml:"local_doh_listen_addresses"`
37- LocalDoHCertFile string `toml:"local_doh_cert_file"`
38- LocalDoHCertKeyFile string `toml:"local_doh_cert_key_file"`
30+ LogLevel int `toml:"log_level"`
31+ LogFile * string `toml:"log_file"`
32+ UseSyslog bool `toml:"use_syslog"`
33+ ServerNames []string `toml:"server_names"`
34+ DisabledServerNames []string `toml:"disabled_server_names"`
35+ ListenAddresses []string `toml:"listen_addresses"`
36+ LocalDoH LocalDoHConfig `toml:"local_doh"`
3937 Daemonize bool
4038 UserName string `toml:"user_name"`
4139 ForceTCP bool `toml:"force_tcp"`
@@ -97,9 +95,6 @@ func newConfig() Config {
9795 return Config {
9896 LogLevel : int (dlog .LogLevel ()),
9997 ListenAddresses : []string {"127.0.0.1:53" },
100- LocalDoHListenAddresses : []string {"127.0.0.1:443" },
101- LocalDoHCertFile : "localhost.pem" ,
102- LocalDoHCertKeyFile : "localhost.pem" ,
10398 Timeout : 5000 ,
10499 KeepAlive : 5 ,
105100 CertRefreshDelay : 240 ,
@@ -195,6 +190,12 @@ type BrokenImplementationsConfig struct {
195190 BrokenQueryPadding []string `toml:"broken_query_padding"`
196191}
197192
193+ type LocalDoHConfig struct {
194+ ListenAddresses []string `toml:"listen_addresses"`
195+ CertFile string `toml:"cert_file"`
196+ CertKeyFile string `toml:"cert_key_file"`
197+ }
198+
198199type ServerSummary struct {
199200 Name string `json:"name"`
200201 Proto string `json:"proto"`
@@ -331,7 +332,7 @@ func ConfigLoad(proxy *Proxy, flags *ConfigFlags) error {
331332 proxy .certRefreshDelayAfterFailure = time .Duration (10 * time .Second )
332333 proxy .certIgnoreTimestamp = config .CertIgnoreTimestamp
333334 proxy .ephemeralKeys = config .EphemeralKeys
334- if len (config .ListenAddresses ) == 0 && len (config .LocalDoHListenAddresses ) == 0 {
335+ if len (config .ListenAddresses ) == 0 && len (config .LocalDoH . ListenAddresses ) == 0 {
335336 dlog .Debug ("No local IP/port configured" )
336337 }
337338
@@ -355,9 +356,9 @@ func ConfigLoad(proxy *Proxy, flags *ConfigFlags) error {
355356 proxy .serversInfo .lbEstimator = config .LBEstimator
356357
357358 proxy .listenAddresses = config .ListenAddresses
358- proxy .localDoHListenAddresses = config .LocalDoHListenAddresses
359- proxy .localDoHCertFile = config .LocalDoHCertFile
360- proxy .localDoHCertKeyFile = config .LocalDoHCertKeyFile
359+ proxy .localDoHListenAddresses = config .LocalDoH . ListenAddresses
360+ proxy .localDoHCertFile = config .LocalDoH . CertFile
361+ proxy .localDoHCertKeyFile = config .LocalDoH . CertKeyFile
361362 proxy .daemonize = config .Daemonize
362363 proxy .pluginBlockIPv6 = config .BlockIPv6
363364 proxy .cache = config .Cache
0 commit comments