mafintosh / dns-packet

An abstract-encoding compliant module for encoding / decoding DNS packets
MIT License
207 stars 71 forks source link

Add encoder for stream transports (TCP/TLS). #23

Closed pusateri closed 6 years ago

pusateri commented 6 years ago

Fixes #16. I'll add example TLS test code for completeness in the future but the payload is the same for TCP.

silverwind commented 6 years ago

Can you add a few words to README about these methods and why they're useful?

pusateri commented 6 years ago

Addressed review comments.

silverwind commented 6 years ago

Am I understanding this correctly that this mode could be used for https://github.com/mafintosh/dns-socket/issues/11?

pusateri commented 6 years ago

Yes, retrying over TCP is the traditional way to solve truncated responses. This pull request adds the encoding for TCP.

silverwind commented 6 years ago

I don't quite get the purpose of exports.stream{En,De}code.bytes, what are they for?

pusateri commented 6 years ago

I was just mimicking exports.encode.bytes and exports.decode.bytes. I'm not sure what they are for either. I figured if existing applications are using these, they may want the stream version. But I can remove them if you want.

silverwind commented 6 years ago

No, it's fine then. We could deprecate them later, but there's likely some reason behind them.