use dns entry in wireguard config file; checkin temporarily disabled til figure issue with dns on checkin

This commit is contained in:
Matthew R Kasun
2021-12-31 16:04:25 +00:00
parent 4ef0b164d7
commit 45464c00f5
4 changed files with 9 additions and 3 deletions

View File

@@ -99,6 +99,8 @@ func RunUserspaceDaemon() {
}
func CheckIn(cfg config.ClientConfig) error {
log.Println("checkin --- diabled for now")
return nil
var err error
var errN error
if cfg.Network == "" {

View File

@@ -83,9 +83,9 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error {
}
}
if ncutils.IsLinux() {
_, err := exec.LookPath("resolvectl")
_, err := exec.LookPath("resolveconf")
if err != nil {
ncutils.PrintLog("resolvectl not present", 2)
ncutils.PrintLog("resolveconf not present", 2)
ncutils.PrintLog("unable to configure DNS automatically, disabling automated DNS management", 2)
cfg.Node.DNSOn = "no"
}

View File

@@ -35,6 +35,7 @@ func GetEmbedded() error {
// CreateUserSpaceConf - creates a user space WireGuard conf
func CreateUserSpaceConf(address string, privatekey string, listenPort string, mtu int32, dns string, perskeepalive int32, peers []wgtypes.PeerConfig) (string, error) {
log.Println("---------- dns passed to create conf ", dns)
peersString, err := parsePeers(perskeepalive, peers)
var listenPortString string
if mtu <= 0 {

View File

@@ -136,7 +136,10 @@ func InitWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig
log.Fatal("no address to configure")
}
nameserver := servercfg.CoreDNSAddr
var nameserver string
if node.DNSOn == "yes" {
nameserver = servercfg.CoreDNSAddr
}
var newConf string
if node.UDPHolePunch != "yes" {
newConf, _ = ncutils.CreateUserSpaceConf(node.Address, key.String(), strconv.FormatInt(int64(node.ListenPort), 10), node.MTU, nameserver, node.PersistentKeepalive, peers)