0
0
Fork 0

Add DomainResource class to wrap MX lookup/normalize (#32864)

This commit is contained in:
Matt Jankowski 2024-11-14 08:47:29 -05:00 committed by GitHub
parent e8b6607ece
commit 62d65504f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 46 additions and 19 deletions

View file

@ -45,12 +45,7 @@ module Mastodon::CLI
end
other_domains = []
if options[:with_dns_records]
Resolv::DNS.open do |dns|
dns.timeouts = 5
other_domains = dns.getresources(domain, Resolv::DNS::Resource::IN::MX).to_a.map { |e| e.exchange.to_s }.compact_blank
end
end
other_domains = DomainResource.new(domain).mx if options[:with_dns_records]
email_domain_block = EmailDomainBlock.new(domain: domain, other_domains: other_domains)
email_domain_block.save!