fix iface on update

This commit is contained in:
afeiszli 2022-04-25 22:06:33 -04:00
parent 894fd1f5bd
commit 551a592a71

View file

@ -435,12 +435,14 @@ func UpdateWgInterface(file, privateKey, nameserver string, node models.Node) er
} }
wireguard.Section(section_interface).Key("PrivateKey").SetValue(privateKey) wireguard.Section(section_interface).Key("PrivateKey").SetValue(privateKey)
wireguard.Section(section_interface).Key("ListenPort").SetValue(strconv.Itoa(int(node.ListenPort))) wireguard.Section(section_interface).Key("ListenPort").SetValue(strconv.Itoa(int(node.ListenPort)))
if node.Address != "" { addrString := node.Address
wireguard.Section(section_interface).Key("Address").SetValue(node.Address)
}
if node.Address6 != "" { if node.Address6 != "" {
wireguard.Section(section_interface).Key("Address").SetValue(node.Address6) if addrString != "" {
addrString += ","
} }
addrString += node.Address6
}
wireguard.Section(section_interface).Key("Address").SetValue(addrString)
//if node.DNSOn == "yes" { //if node.DNSOn == "yes" {
// wireguard.Section(section_interface).Key("DNS").SetValue(nameserver) // wireguard.Section(section_interface).Key("DNS").SetValue(nameserver)
//} //}