[FEATURE] Ability to specify MX record priority
bestwebua opened this issue · comments
New feature request checklist
- I have updated
dns_mock
to the latest version - I have read the Contribution Guidelines
- I have read the documentation
- I have searched for existing GitHub issues
Feature description
Current behaviour of MX records builder is assigning priority with step 10 from first item of defined MX records array. It's simple for use, but in current implementation it impossible to define null or backup MX records. So it will be a right solution to add ability to specify custom priority of MX record if it needed.
Done.
records = {
'example.com' => {
mx: %w[.:0 mx1.domain.com:10 mx2.domain.com:10 mx3.domain.com]
}
}
DnsMock.start_server(records: records, port: 5300)
dig @localhost -p 5300 MX example.com
; <<>> DiG 9.10.6 <<>> @localhost -p 5300 MX example.com
;; ANSWER SECTION:
example.com. 1 IN MX 0 .
example.com. 1 IN MX 10 mx1.domain.com.
example.com. 1 IN MX 10 mx2.domain.com.
example.com. 1 IN MX 40 mx3.domain.com.
;; Query time: 0 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Wed Feb 03 20:19:51 EET 2021
;; MSG SIZE rcvd: 102