mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-30 00:45:20 +08:00
include ipv6 for extclients
This commit is contained in:
parent
0b0db1c0e8
commit
98e66b7292
1 changed files with 14 additions and 10 deletions
|
@ -203,15 +203,13 @@ func PublishAllDNS(newnode *models.Node) error {
|
|||
logger.Log(0, "error retrieving host for dns update", host.ID.String(), err.Error())
|
||||
continue
|
||||
}
|
||||
dns.Action = models.DNSInsert
|
||||
dns.Name = host.Name + "." + node.Network
|
||||
if node.Address.IP != nil {
|
||||
dns.Action = models.DNSInsert
|
||||
dns.Name = host.Name + "." + node.Network
|
||||
dns.Address = node.Address.IP.String()
|
||||
alldns = append(alldns, dns)
|
||||
}
|
||||
if node.Address6.IP != nil {
|
||||
dns.Action = models.DNSInsert
|
||||
dns.Name = host.Name + "." + node.Network
|
||||
dns.Address = node.Address6.IP.String()
|
||||
alldns = append(alldns, dns)
|
||||
}
|
||||
|
@ -223,17 +221,23 @@ func PublishAllDNS(newnode *models.Node) error {
|
|||
for _, client := range clients {
|
||||
dns.Action = models.DNSInsert
|
||||
dns.Name = client.ClientID + "." + client.Network
|
||||
dns.Address = client.Address
|
||||
alldns = append(alldns, dns)
|
||||
if client.Address != "" {
|
||||
dns.Address = client.Address
|
||||
alldns = append(alldns, dns)
|
||||
}
|
||||
if client.Address6 != "" {
|
||||
dns.Address = client.Address
|
||||
alldns = append(alldns, dns)
|
||||
}
|
||||
}
|
||||
entries, err := logic.GetCustomDNS(newnode.Network)
|
||||
customdns, err := logic.GetCustomDNS(newnode.Network)
|
||||
if err != nil {
|
||||
logger.Log(0, "error retrieving custom dns entries", err.Error())
|
||||
}
|
||||
for _, entry := range entries {
|
||||
for _, custom := range customdns {
|
||||
dns.Action = models.DNSInsert
|
||||
dns.Address = entry.Address
|
||||
dns.Name = entry.Name + "." + entry.Network
|
||||
dns.Address = custom.Address
|
||||
dns.Name = custom.Name + "." + custom.Network
|
||||
alldns = append(alldns, dns)
|
||||
}
|
||||
data, err := json.Marshal(alldns)
|
||||
|
|
Loading…
Add table
Reference in a new issue