aboutsummaryrefslogtreecommitdiff
path: root/lib/dns/testdata
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-08-06 01:59:43 +0700
committerShulhan <ms@kilabit.info>2023-08-06 01:59:43 +0700
commitbc72ce40b3c848ba2a4b681ace5295af22b0d6ca (patch)
tree746b622b6e144e0461dd06cf42f4b5fa5a0f1111 /lib/dns/testdata
parentb635e64ce383bf647082aadbb88395081236106d (diff)
downloadpakakeh.go-bc72ce40b3c848ba2a4b681ace5295af22b0d6ca.tar.xz
lib/dns: add method AddAuthority to Message
The AddAuthority add the rr to list of Authority. Calling this method mark the message as answer, instead of query. If the rr is SOA, it will replace the existing record if exist and set the flag authoritative answer (IsAA) in header to true. If the rr is NS, it will be added only if its not exist. It will return an error if the rr type is not SOA or NS or the size of records in Authority is full, maximum four records.
Diffstat (limited to 'lib/dns/testdata')
-rw-r--r--lib/dns/testdata/message/add_authority_test.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/dns/testdata/message/add_authority_test.txt b/lib/dns/testdata/message/add_authority_test.txt
new file mode 100644
index 00000000..494b26fe
--- /dev/null
+++ b/lib/dns/testdata/message/add_authority_test.txt
@@ -0,0 +1,28 @@
+Test data for Message.AddAuthority method.
+
+<<< error_with_txt
+AddAuthority: expecting SOA or NS, got TXT
+
+<<< error_full
+AddAuthority: records is full
+
+<<< packet
+{Name: Type:A}
+ | 0 1 2 3 4 5 6 7 | 01234567 | 0 1 2 3 4 5 6 7 |
+ | 8 9 A B C D E F | 89ABCDEF | 8 9 A B C D E F |
+0x00000000| 00 00 85 00 00 01 00 00 | ........ | 0 0 133 0 0 1 0 0 |0
+0x00000008| 00 04 00 00 00 00 01 00 | ........ | 0 4 0 0 0 0 1 0 |8
+0x00000010| 01 06 75 70 64 61 74 65 | ..update | 1 6 117 112 100 97 116 101 |16
+0x00000018| 03 73 6f 61 00 00 06 00 | .soa.... | 3 115 111 97 0 0 6 0 |24
+0x00000020| 01 00 00 00 00 00 21 04 | ......!. | 1 0 0 0 0 0 33 4 |32
+0x00000028| 74 65 73 74 c0 18 04 72 | test...r | 116 101 115 116 192 24 4 114 |40
+0x00000030| 6f 6f 74 00 64 cd ff f0 | oot.d... | 111 111 116 0 100 205 255 240 |48
+0x00000038| 00 01 51 80 00 00 0e 10 | ..Q..... | 0 1 81 128 0 0 14 16 |56
+0x00000040| 00 00 00 00 00 00 0e 10 | ........ | 0 0 0 0 0 0 14 16 |64
+0x00000048| c0 11 00 02 00 01 00 00 | ........ | 192 17 0 2 0 1 0 0 |72
+0x00000050| 00 00 00 06 03 6e 73 31 | .....ns1 | 0 0 0 6 3 110 115 49 |80
+0x00000058| c0 11 c0 11 00 02 00 01 | ........ | 192 17 192 17 0 2 0 1 |88
+0x00000060| 00 00 00 00 00 06 03 6e | .......n | 0 0 0 0 0 6 3 110 |96
+0x00000068| 73 32 c0 11 c0 11 00 02 | s2...... | 115 50 192 17 192 17 0 2 |104
+0x00000070| 00 01 00 00 00 00 00 06 | ........ | 0 1 0 0 0 0 0 6 |112
+0x00000078| 03 6e 73 33 c0 11 | .ns3.. | 3 110 115 51 192 17 |120