MCPcopy
hub / github.com/slackhq/nebula / Add

Method Add

dns_server.go:84–102  ·  view source on GitHub ↗

Add adds the first IPv4 and IPv6 address that appears in `addresses` as the record for `host`

(host string, addresses []netip.Addr)

Source from the content-addressed store, hash-verified

82
83// Add adds the first IPv4 and IPv6 address that appears in `addresses` as the record for `host`
84func (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
104func (d *dnsRecords) isSelfNebulaOrLocalhost(addr string) bool {
105 a, _, _ := net.SplitHostPort(addr)

Callers 15

inConnsMethod · 0.45
addConnMethod · 0.45
evictMethod · 0.45
SendViaMethod · 0.45
sendNoMetricsMethod · 0.45
handleOutboundMethod · 0.45
StartHandshakeMethod · 0.45
NewConnectionStateFunction · 0.45
TestTimerWheel_AddFunction · 0.45

Calls

no outgoing calls