EmilHernvall / dnsguide

A guide to writing a DNS Server from scratch in Rust
MIT License
3.92k stars 246 forks source link

DNS compression when writing labels #23

Closed ema2159 closed 1 year ago

ema2159 commented 1 year ago

Hello. I am currently following your tutorial (great tutorial by the way), and am currently implementing the write methods for the stub resolver section. However, there is something that I don't quite understand: In chapter 1, the read_qname function implemented this label compression idea by jumping to and reusing old labels. However, in chapter two, the write_qname function doesn't implement the same idea. Did you just chose not to implement it, or is there something I am missing?

Thanks beforehand!

EmilHernvall commented 1 year ago

Yeah, that’s it. For simplicity, I omitted it, since it’s an optional feature. I believe I did implement it in EmilHernvall/hermes though, so if you want to see one way to do it, check there.

ema2159 commented 1 year ago

Thanks a lot for the clarification Emil. I will give it a try myself and then take a look at hermes.

Regards.