@@ 49,8 49,20 @@ func parseQuery(m *dns.Msg, r *dns.Msg) {
}
func handleARecord(q *dns.Question, m *dns.Msg, r *dns.Msg) {
- if index := strings.IndexByte(q.Name, '.'); index >= 0 {
- aRecord, err := db.FetchDomainARecord(strings.ToLower(q.Name[:index]))
+ qName := strings.ToLower(q.Name)
+
+ // TODO: This is probably not a great way to handle this, but it is what it is. For now.
+ // "Root" Domain A.
+ if qName == config.FeluConfig.Domain {
+ m.Answer = append(m.Answer, &dns.A{
+ Hdr: dns.RR_Header{Name: q.Name, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 60},
+ A: net.ParseIP(config.FeluConfig.IPv4),
+ })
+ return
+ }
+
+ if index := strings.IndexByte(qName, '.'); index >= 0 {
+ aRecord, err := db.FetchDomainARecord(qName[:index])
if err != nil {
m.SetRcode(r, dns.RcodeNameError)
} else {