|
|
@ -25,6 +25,7 @@ var (
|
|
|
|
dnsCache syncs.AtomicValue[dnsEntryMap]
|
|
|
|
dnsCache syncs.AtomicValue[dnsEntryMap]
|
|
|
|
dnsCacheBytes syncs.AtomicValue[[]byte] // of JSON
|
|
|
|
dnsCacheBytes syncs.AtomicValue[[]byte] // of JSON
|
|
|
|
unpublishedDNSCache syncs.AtomicValue[dnsEntryMap]
|
|
|
|
unpublishedDNSCache syncs.AtomicValue[dnsEntryMap]
|
|
|
|
|
|
|
|
bootstrapLookupMap syncs.Map[string, bool]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var (
|
|
|
@ -35,6 +36,12 @@ var (
|
|
|
|
unpublishedDNSMisses = expvar.NewInt("counter_bootstrap_dns_unpublished_misses")
|
|
|
|
unpublishedDNSMisses = expvar.NewInt("counter_bootstrap_dns_unpublished_misses")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
|
|
expvar.Publish("counter_bootstrap_dns_queried_domains", expvar.Func(func() any {
|
|
|
|
|
|
|
|
return bootstrapLookupMap.Len()
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func refreshBootstrapDNSLoop() {
|
|
|
|
func refreshBootstrapDNSLoop() {
|
|
|
|
if *bootstrapDNS == "" && *unpublishedDNS == "" {
|
|
|
|
if *bootstrapDNS == "" && *unpublishedDNS == "" {
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -107,6 +114,7 @@ func handleBootstrapDNS(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
|
|
|
|
// Try answering a query from our hidden map first
|
|
|
|
// Try answering a query from our hidden map first
|
|
|
|
if q := r.URL.Query().Get("q"); q != "" {
|
|
|
|
if q := r.URL.Query().Get("q"); q != "" {
|
|
|
|
|
|
|
|
bootstrapLookupMap.Store(q, true)
|
|
|
|
if ips, ok := unpublishedDNSCache.Load()[q]; ok && len(ips) > 0 {
|
|
|
|
if ips, ok := unpublishedDNSCache.Load()[q]; ok && len(ips) > 0 {
|
|
|
|
unpublishedDNSHits.Add(1)
|
|
|
|
unpublishedDNSHits.Add(1)
|
|
|
|
|
|
|
|
|
|
|
|