[PR #1125] [MERGED] Allow creating TXT Rdata with binary data #1988

Closed
opened 2026-03-16 04:20:29 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1125
Author: @bltavares
Created: 6/1/2020
Status: Merged
Merged: 6/5/2020
Merged by: @bluejekyll

Base: masterHead: allow-creating-txt-with-binary-data


📝 Commits (2)

  • 8d35e92 Allow creating TXT Rdata with binary data
  • abfd448 Merge branch 'master' into allow-creating-txt-with-binary-data

📊 Changes

1 file changed (+38 additions, -0 deletions)

View changed files

📝 crates/proto/src/rr/rdata/txt.rs (+38 -0)

📄 Description

As discussed on https://github.com/bluejekyll/trust-dns/issues/139, it
is possible to create TXT records which respond to binary data.

Hyperswarm is one of such
systems which sends TXT data with binary records, like the captured
packet.

Captured TXT with binary data
0000   02 00 00 00 45 00 01 0e d2 b1 00 00 ff 11 00 00   ....E...........
0010   c0 a8 89 01 e0 00 00 fb 14 e9 14 e9 00 fa b8 f7   ................
0020   00 00 84 00 00 00 00 03 00 00 00 00 28 31 65 39   ............(1e9
0030   35 66 37 32 31 39 61 62 63 32 32 35 34 61 33 33   5f7219abc2254a33
0040   39 36 63 37 62 63 39 32 37 31 62 65 35 37 63 65   96c7bc9271be57ce
0050   39 37 38 35 35 0a 68 79 70 65 72 73 77 61 72 6d   97855.hyperswarm
0060   05 6c 6f 63 61 6c 00 00 21 00 01 00 00 00 00 00   .local..!.......
0070   0f 00 00 00 00 f0 18 01 30 01 30 01 30 01 30 00   ........0.0.0.0.
0080   28 31 65 39 35 66 37 32 31 39 61 62 63 32 32 35   (1e95f7219abc225
0090   34 61 33 33 39 36 63 37 62 63 39 32 37 31 62 65   4a3396c7bc9271be
00a0   35 37 63 65 39 37 38 35 35 0a 68 79 70 65 72 73   57ce97855.hypers
00b0   77 61 72 6d 05 6c 6f 63 61 6c 00 00 10 00 01 00   warm.local......
00c0   00 00 00 00 24 23 69 64 3d fb 41 9f bc b9 16 d8   ....$#id=.A.....
00d0   c5 15 d7 04 49 5e 5a 93 96 fa 7e ca d6 3e b6 2e   ....I^Z...~..>..
00e0   df 01 d9 9e 04 63 ff de 25 08 72 65 66 65 72 72   .....c..%.referr
00f0   65 72 0a 68 79 70 65 72 73 77 61 72 6d 05 6c 6f   er.hyperswarm.lo
0100   63 61 6c 00 00 01 00 01 00 00 00 00 00 04 c0 a8   cal.............
0110   89 01 02 00 00 00 00 00 00 90 02 00 00 00 00 00   ................
0120   00 00 00 00 00 00                                 ......

While parsing seems to be possible with the work on #325, it was not
possible to create a response using trust-dns, as it requires a
Vec<String>, which only allows valid utf-8 data.

This commit adds a new builder for TXT, which allows sending a vec of
bytes, so it can create the appropriate response using binary data.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/1125 **Author:** [@bltavares](https://github.com/bltavares) **Created:** 6/1/2020 **Status:** ✅ Merged **Merged:** 6/5/2020 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `master` ← **Head:** `allow-creating-txt-with-binary-data` --- ### 📝 Commits (2) - [`8d35e92`](https://github.com/hickory-dns/hickory-dns/commit/8d35e92ccfd650070917d840a389df2beb7e9f02) Allow creating TXT Rdata with binary data - [`abfd448`](https://github.com/hickory-dns/hickory-dns/commit/abfd448dd8142da3091fb7445ba1b1f25785bc3f) Merge branch 'master' into allow-creating-txt-with-binary-data ### 📊 Changes **1 file changed** (+38 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/proto/src/rr/rdata/txt.rs` (+38 -0) </details> ### 📄 Description As discussed on https://github.com/bluejekyll/trust-dns/issues/139, it is possible to create TXT records which respond to binary data. [Hyperswarm](https://github.com/hyperswarm/discovery) is one of such systems which sends TXT data with binary records, like the captured packet. <details> <summary>Captured TXT with binary data</summary> ``` 0000 02 00 00 00 45 00 01 0e d2 b1 00 00 ff 11 00 00 ....E........... 0010 c0 a8 89 01 e0 00 00 fb 14 e9 14 e9 00 fa b8 f7 ................ 0020 00 00 84 00 00 00 00 03 00 00 00 00 28 31 65 39 ............(1e9 0030 35 66 37 32 31 39 61 62 63 32 32 35 34 61 33 33 5f7219abc2254a33 0040 39 36 63 37 62 63 39 32 37 31 62 65 35 37 63 65 96c7bc9271be57ce 0050 39 37 38 35 35 0a 68 79 70 65 72 73 77 61 72 6d 97855.hyperswarm 0060 05 6c 6f 63 61 6c 00 00 21 00 01 00 00 00 00 00 .local..!....... 0070 0f 00 00 00 00 f0 18 01 30 01 30 01 30 01 30 00 ........0.0.0.0. 0080 28 31 65 39 35 66 37 32 31 39 61 62 63 32 32 35 (1e95f7219abc225 0090 34 61 33 33 39 36 63 37 62 63 39 32 37 31 62 65 4a3396c7bc9271be 00a0 35 37 63 65 39 37 38 35 35 0a 68 79 70 65 72 73 57ce97855.hypers 00b0 77 61 72 6d 05 6c 6f 63 61 6c 00 00 10 00 01 00 warm.local...... 00c0 00 00 00 00 24 23 69 64 3d fb 41 9f bc b9 16 d8 ....$#id=.A..... 00d0 c5 15 d7 04 49 5e 5a 93 96 fa 7e ca d6 3e b6 2e ....I^Z...~..>.. 00e0 df 01 d9 9e 04 63 ff de 25 08 72 65 66 65 72 72 .....c..%.referr 00f0 65 72 0a 68 79 70 65 72 73 77 61 72 6d 05 6c 6f er.hyperswarm.lo 0100 63 61 6c 00 00 01 00 01 00 00 00 00 00 04 c0 a8 cal............. 0110 89 01 02 00 00 00 00 00 00 90 02 00 00 00 00 00 ................ 0120 00 00 00 00 00 00 ...... ``` </details> While parsing seems to be possible with the work on #325, it was not possible to create a response using `trust-dns`, as it requires a `Vec<String>`, which only allows valid `utf-8` data. This commit adds a new builder for `TXT`, which allows sending a vec of bytes, so it can create the appropriate response using binary data. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 04:20:29 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#1988
No description provided.