You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a domain name and an rrtype and I want to construct a corresponding fully functional dns.RR instance with empty RDATA. This is required for dns.Msg.RemoveRRset(), and I also need to perform some other processing on these records. However, I couldn’t find any documentation on the intended way to do this.
I tried using a plain *dns.RR_Header. This mostly works since *dns.RR_Header formally implements dns.RR, but its dns.RR.copy implementation just returns nil, so dns.Copy doesn't work with such instances.
I also tried using dns.NewRR(fmt.Sprintf("%s %d IN %s", domain, ttl, dns.TypeToString[rrtype])). This also mostly works but for TXT records it seems dns.PackRR needs a larger buffer than what's reported by dns.Len.
I had a look at the source code for dns.RemoveRRset and realized that wrapping the dns.RR_Header in a dns.ANY might be a solution. So far I haven't stumbled on any surprising behaviors with this solution, but I'm not confident about its robustness either.
What is the recommended way to construct a dns.RR instance with empty RDATA?
The text was updated successfully, but these errors were encountered:
I have a domain name and an rrtype and I want to construct a corresponding fully functional dns.RR instance with empty RDATA. This is required for dns.Msg.RemoveRRset(), and I also need to perform some other processing on these records. However, I couldn’t find any documentation on the intended way to do this.
I tried using a plain *dns.RR_Header. This mostly works since *dns.RR_Header formally implements dns.RR, but its dns.RR.copy implementation just returns nil, so dns.Copy doesn't work with such instances.
I also tried using dns.NewRR(fmt.Sprintf("%s %d IN %s", domain, ttl, dns.TypeToString[rrtype])). This also mostly works but for TXT records it seems dns.PackRR needs a larger buffer than what's reported by dns.Len.
I had a look at the source code for dns.RemoveRRset and realized that wrapping the dns.RR_Header in a dns.ANY might be a solution. So far I haven't stumbled on any surprising behaviors with this solution, but I'm not confident about its robustness either.
What is the recommended way to construct a dns.RR instance with empty RDATA?
The text was updated successfully, but these errors were encountered: