From 8311f2c761abc0b75f9657a70cb434d6df6844db Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 5 Jun 2020 18:36:45 -0600 Subject: conf: add support for search domains inside dns line Signed-off-by: Jason A. Donenfeld --- conf/writer.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'conf/writer.go') diff --git a/conf/writer.go b/conf/writer.go index 748c1d61..ab2810c0 100644 --- a/conf/writer.go +++ b/conf/writer.go @@ -28,11 +28,12 @@ func (conf *Config) ToWgQuick() string { output.WriteString(fmt.Sprintf("Address = %s\n", strings.Join(addrStrings[:], ", "))) } - if len(conf.Interface.DNS) > 0 { - addrStrings := make([]string, len(conf.Interface.DNS)) - for i, address := range conf.Interface.DNS { - addrStrings[i] = address.String() + if len(conf.Interface.DNS) + len(conf.Interface.DNSSearch) > 0 { + addrStrings := make([]string, 0, len(conf.Interface.DNS) + len(conf.Interface.DNSSearch)) + for _, address := range conf.Interface.DNS { + addrStrings = append(addrStrings, address.String()) } + addrStrings = append(addrStrings, conf.Interface.DNSSearch...) output.WriteString(fmt.Sprintf("DNS = %s\n", strings.Join(addrStrings[:], ", "))) } -- cgit v1.2.3-59-g8ed1b