mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
cmd/ctrld: add --iface for setting DNS on specific interface
This commit is contained in:
committed by
Cuong Manh Le
parent
d5344aea52
commit
b00a7c34ee
+2
-14
@@ -3,21 +3,9 @@
|
||||
package ctrld
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"tailscale.com/net/dns/resolvconffile"
|
||||
"github.com/Control-D-Inc/ctrld/internal/resolvconffile"
|
||||
)
|
||||
|
||||
const resolvconfPath = "/etc/resolv.conf"
|
||||
|
||||
func nameservers() []string {
|
||||
c, err := resolvconffile.ParseFile(resolvconfPath)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
ns := make([]string, 0, len(c.Nameservers))
|
||||
for _, nameserver := range c.Nameservers {
|
||||
ns = append(ns, net.JoinHostPort(nameserver.String(), "53"))
|
||||
}
|
||||
return ns
|
||||
return resolvconffile.NameServersWithPort()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user