Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't figure out how to access rdata as [u8] #38

Open
pusateri opened this issue Oct 2, 2018 · 1 comment
Open

can't figure out how to access rdata as [u8] #38

pusateri opened this issue Oct 2, 2018 · 1 comment

Comments

@pusateri
Copy link

pusateri commented Oct 2, 2018

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.

@tailhook
Copy link
Owner

We don't have such field for now. But also our record types are bad for caches in the following ways:

  1. Non-static lifetimes
  2. Records should be order-independent. E.g. 127.0.0.1, 127.0.0.2 should be same as 127.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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants