handle SOA

This commit is contained in:
m5r 2022-10-30 00:14:03 +02:00
parent 8901182784
commit 0adf0a23e3
No known key found for this signature in database
GPG Key ID: 5BC847276DD5DDEA

View File

@ -235,6 +235,10 @@ func (xip *Xip) handleCNAME(question dns.Question, message *dns.Msg) {
} }
} }
func (xip *Xip) handleSOA(question dns.Question, message *dns.Msg) {
message.Answer = append(message.Answer, xip.SOARecord(question))
}
func (xip *Xip) SOARecord(question dns.Question) *dns.SOA { func (xip *Xip) SOARecord(question dns.Question) *dns.SOA {
soa := new(dns.SOA) soa := new(dns.SOA)
soa.Hdr = dns.RR_Header{ soa.Hdr = dns.RR_Header{
@ -245,7 +249,7 @@ func (xip *Xip) SOARecord(question dns.Question) *dns.SOA {
Ttl: uint32((time.Second * 10).Seconds()), Ttl: uint32((time.Second * 10).Seconds()),
Rdlength: 0, Rdlength: 0,
} }
soa.Ns = "ns.local-ip.sh." soa.Ns = "ns1.local-ip.sh."
soa.Mbox = "admin.local-ip.sh." soa.Mbox = "admin.local-ip.sh."
soa.Serial = 2022102800 soa.Serial = 2022102800
// soa.Refresh = uint32((time.Minute * 15).Seconds()) // soa.Refresh = uint32((time.Minute * 15).Seconds())
@ -276,6 +280,8 @@ func (xip *Xip) handleQuery(message *dns.Msg) {
xip.handleMX(question, message) xip.handleMX(question, message)
case dns.TypeCNAME: case dns.TypeCNAME:
xip.handleCNAME(question, message) xip.handleCNAME(question, message)
case dns.TypeSOA:
xip.handleSOA(question, message)
} }
} }
} }