BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr
fixed bugs.
Jack9f57e68d1e9d
diff --git a/core/internal/service/domains/dns.go b/core/internal/service/domains/dns.goindex 0fd2ff40..68fcb147 100644--- a/core/internal/service/domains/dns.go+++ b/core/internal/service/domains/dns.go@@ -37,6 +37,10 @@ func ValidateTXTRecord(record v1.DNSRecord, domain string) bool {return false}+ if record.Host != "@" {+ domain = record.Host + "." + domain+ }+cacheKey := "txt_records_" + domaintxtRecords := make([]string, 0)cacheTxtRecords := public.GetCache(cacheKey)@@ -91,3 +95,27 @@ func ValidateMXRecord(record v1.DNSRecord, domain string) bool {return false}++// ValidatePTRRecord checks if the given PTR record is valid+func ValidatePTRRecord(record v1.DNSRecord) bool {+ if strings.ToUpper(record.Type) != "PTR" {+ return false+ }++ // Query PTR records+ ptrRecords, err := net.LookupAddr(record.Host)+ if err != nil {+ return false+ }++ g.Log().Debug(context.Background(), "query ptr record success", ptrRecords)++ // Check if any PTR record matches the expected value+ for _, ptr := range ptrRecords {+ if strings.TrimSuffix(ptr, ".") == record.Value {+ return true+ }+ }++ return false+}diff --git a/core/internal/service/domains/domains.go b/core/internal/service/domains/domains.goindex 4f3ded3c..ad075341 100644--- a/core/internal/service/domains/domains.go+++ b/core/internal/service/domains/domains.go@@ -455,11 +455,12 @@ func GetPTRRecord(domain string) (record v1.DNSRecord, err error) {}// Validate the PTR record- // record.Valid = ValidatePTRRecord(record)+ record.Valid = ValidatePTRRecord(record)return}+// GetRecordsInCache retrieves DNS records from the cache for a given domain.func GetRecordsInCache(domain string) (records v1.DNSRecords) {// Get A record from cacheaRecord := public.GetCache(buildCacheKey(domain, "A"))