@@ -22,13 +22,11 @@ import (
22
22
"bufio"
23
23
"bytes"
24
24
"context"
25
- _ "embed"
26
25
"fmt"
27
26
"io"
28
27
"io/fs"
29
28
"net/netip"
30
29
"os"
31
- "slices"
32
30
"strconv"
33
31
"strings"
34
32
"text/template"
@@ -145,7 +143,7 @@ func (rc *ResolvConf) SetHeader(c string) {
145
143
146
144
// NameServers returns addresses used in nameserver directives.
147
145
func (rc * ResolvConf ) NameServers () []netip.Addr {
148
- return slices . Clone ( rc .nameServers )
146
+ return append ([]netip. Addr ( nil ), rc .nameServers ... )
149
147
}
150
148
151
149
// OverrideNameServers replaces the current set of nameservers.
@@ -156,7 +154,7 @@ func (rc *ResolvConf) OverrideNameServers(nameServers []netip.Addr) {
156
154
157
155
// Search returns the current DNS search domains.
158
156
func (rc * ResolvConf ) Search () []string {
159
- return slices . Clone ( rc .search )
157
+ return append ([] string ( nil ), rc .search ... )
160
158
}
161
159
162
160
// OverrideSearch replaces the current DNS search domains.
@@ -173,7 +171,7 @@ func (rc *ResolvConf) OverrideSearch(search []string) {
173
171
174
172
// Options returns the current options.
175
173
func (rc * ResolvConf ) Options () []string {
176
- return slices . Clone ( rc .options )
174
+ return append ([] string ( nil ), rc .options ... )
177
175
}
178
176
179
177
// Option finds the last option named search, and returns (value, true) if
@@ -196,7 +194,7 @@ func (rc *ResolvConf) Option(search string) (string, bool) {
196
194
197
195
// OverrideOptions replaces the current DNS options.
198
196
func (rc * ResolvConf ) OverrideOptions (options []string ) {
199
- rc .options = slices . Clone ( options )
197
+ rc .options = append ([] string ( nil ), options ... )
200
198
rc .md .NDotsFrom = ""
201
199
if _ , exists := rc .Option ("ndots" ); exists {
202
200
rc .md .NDotsFrom = "override"
@@ -318,7 +316,7 @@ func (rc *ResolvConf) TransformForIntNS(
318
316
}
319
317
320
318
rc .md .Transform = "internal resolver"
321
- return slices . Clone ( rc .md .ExtNameServers ), nil
319
+ return append ([] ExtDNSEntry ( nil ), rc .md .ExtNameServers ... ), nil
322
320
}
323
321
324
322
// Generate returns content suitable for writing to a resolv.conf file. If comments
0 commit comments