Add adds the first IPv4 and IPv6 address that appears in `addresses` as the record for `host`
(host string, addresses []netip.Addr)
| 82 | |
| 83 | // Add adds the first IPv4 and IPv6 address that appears in `addresses` as the record for `host` |
| 84 | func (d *dnsRecords) Add(host string, addresses []netip.Addr) { |
| 85 | host = strings.ToLower(host) |
| 86 | d.Lock() |
| 87 | defer d.Unlock() |
| 88 | haveV4 := false |
| 89 | haveV6 := false |
| 90 | for _, addr := range addresses { |
| 91 | if addr.Is4() && !haveV4 { |
| 92 | d.dnsMap4[host] = addr |
| 93 | haveV4 = true |
| 94 | } else if addr.Is6() && !haveV6 { |
| 95 | d.dnsMap6[host] = addr |
| 96 | haveV6 = true |
| 97 | } |
| 98 | if haveV4 && haveV6 { |
| 99 | break |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func (d *dnsRecords) isSelfNebulaOrLocalhost(addr string) bool { |
| 105 | a, _, _ := net.SplitHostPort(addr) |
no outgoing calls