mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-06 05:04:27 +08:00
rebase with dns nameservers, add egress domain to match domains updates
This commit is contained in:
parent
e25aa63916
commit
434f7940b8
1 changed files with 20 additions and 0 deletions
20
logic/dns.go
20
logic/dns.go
|
@ -463,7 +463,27 @@ func GetNameserversForHost(h *models.Host) (returnNsLi []models.Nameserver) {
|
|||
}
|
||||
returnNsLi = append(returnNsLi, globalNs)
|
||||
}
|
||||
// add egress domains to list
|
||||
e := schema.Egress{
|
||||
Network: node.Network,
|
||||
}
|
||||
egs, _ := e.ListByNetwork(db.WithContext(context.TODO()))
|
||||
for _, egI := range egs {
|
||||
if egI.Domain != "" && len(egI.DomainAns) > 0 {
|
||||
egressNs := models.Nameserver{
|
||||
MatchDomain: egI.Domain,
|
||||
}
|
||||
if node.Address.IP != nil {
|
||||
egressNs.IPs = append(egressNs.IPs, node.Address.IP.String())
|
||||
}
|
||||
if node.Address6.IP != nil {
|
||||
egressNs.IPs = append(egressNs.IPs, node.Address6.IP.String())
|
||||
}
|
||||
returnNsLi = append(returnNsLi, egressNs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue