Chore: adjust tun RelayDnsPacket

This commit is contained in:
yaling888 2022-03-25 04:09:11 +08:00
parent c6efa74a6b
commit 4a4b1bdb83

View file

@ -28,15 +28,9 @@ func RelayDnsPacket(payload []byte) ([]byte, error) {
r, err := resolver.ServeMsg(msg) r, err := resolver.ServeMsg(msg)
if err != nil { if err != nil {
return nil, err m := new(D.Msg)
} m.SetRcode(msg, D.RcodeServerFailure)
return m.Pack()
for _, ans := range r.Answer {
header := ans.Header()
if header.Class == D.ClassINET && (header.Rrtype == D.TypeA || header.Rrtype == D.TypeAAAA) {
header.Ttl = 1
}
} }
r.SetRcode(msg, r.Rcode) r.SetRcode(msg, r.Rcode)