mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-28 20:12:27 +00:00
net/dns: close ctx when close dns directManager
Signed-off-by: Asutorufa <16442314+Asutorufa@users.noreply.github.com>
This commit is contained in:
parent
1d2af801fa
commit
e20ce7bf0c
@ -403,6 +403,8 @@ func (m *directManager) GetBaseConfig() (OSConfig, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *directManager) Close() error {
|
func (m *directManager) Close() error {
|
||||||
|
m.ctxClose()
|
||||||
|
|
||||||
// We used to keep a file for the tailscale config and symlinked
|
// We used to keep a file for the tailscale config and symlinked
|
||||||
// to it, but then we stopped because /etc/resolv.conf being a
|
// to it, but then we stopped because /etc/resolv.conf being a
|
||||||
// symlink to surprising places breaks snaps and other sandboxing
|
// symlink to surprising places breaks snaps and other sandboxing
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package dns
|
package dns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@ -78,7 +79,10 @@ func testDirect(t *testing.T, fs wholeFileFS) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m := directManager{logf: t.Logf, fs: fs}
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
m := directManager{logf: t.Logf, fs: fs, ctx: ctx, ctxClose: cancel}
|
||||||
if err := m.SetDNS(OSConfig{
|
if err := m.SetDNS(OSConfig{
|
||||||
Nameservers: []netip.Addr{netip.MustParseAddr("8.8.8.8"), netip.MustParseAddr("8.8.4.4")},
|
Nameservers: []netip.Addr{netip.MustParseAddr("8.8.8.8"), netip.MustParseAddr("8.8.4.4")},
|
||||||
SearchDomains: []dnsname.FQDN{"ts.net.", "ts-dns.test."},
|
SearchDomains: []dnsname.FQDN{"ts.net.", "ts-dns.test."},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user