can't figure out how to access rdata as [u8]
pusateri opened this issue · 1 comments
After parsing a packet and looping through the resource records in the answers, I'm trying to access the Rdata as a vector of [u8] bytes. But being new to Rust, I can't figure this out.
RData::A(Record(ip))
Gives me an IPv4Addr and I can do similar things for other record types but I just want the raw [u8] for caching and duplicate detection.
We don't have such field for now. But also our record types are bad for caches in the following ways:
- Non-static lifetimes
- Records should be order-independent. E.g.
127.0.0.1, 127.0.0.2
should be same as127.0.0.2, 127.0.0.1
(for A record)
Also raw bytes are bad. Because depending on implementation on the other side, bytes here may refer to bytes outside of the resource record range byte (there is kind of dns names compression in the packet which may refer to any other name declared within packet boundaries).
So it's better to make your own type which can be cached safely (and it should probably be enum too)