Pārlūkot izejas kodu

fixed bug in bulk_query

boB Rudis 1 gadu atpakaļ
vecāks
revīzija
8b81f02629
Šim parakstam datu bāzē netika atrasta zināma atslēga
7 mainītis faili ar 175 papildinājumiem un 321 dzēšanām
  1. 1
    0
      .Rbuildignore
  2. 1
    1
      DESCRIPTION
  3. 4
    0
      NEWS.md
  4. 20
    6
      R/zbulk-query.R
  5. 7
    6
      README.Rmd
  6. 128
    308
      README.md
  7. 14
    0
      tools/mk-rsrc-rcrd-tbl.R

+ 1
- 0
.Rbuildignore Parādīt failu

@@ -7,3 +7,4 @@
7 7
 ^README\.Rmd$
8 8
 ^cran-comments\.md$
9 9
 ^docs$
10
+^tools$

+ 1
- 1
DESCRIPTION Parādīt failu

@@ -1,6 +1,6 @@
1 1
 Package: gdns
2 2
 Title: Tools to Work with Google's 'DNS-over-HTTPS' ('DoH') 'API'
3
-Version: 0.3.0
3
+Version: 0.3.1
4 4
 Authors@R: c(
5 5
         person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), 
6 6
                comment = c(ORCID = "0000-0001-5670-2640"))

+ 4
- 0
NEWS.md Parādīt failu

@@ -1,3 +1,7 @@
1
+# gdns 0.3.1
2
+
3
+* fixed bug in `bulk_query()`
4
+
1 5
 # gdns 0.3.0
2 6
 
3 7
 * removed purrr, dplyr and tibble dependencies

+ 20
- 6
R/zbulk-query.R Parādīt failu

@@ -24,15 +24,29 @@
24 24
 #' gdns::bulk_query(hosts)
25 25
 bulk_query <- function(entities, type = 1, edns_client_subnet = "0.0.0.0/0") {
26 26
 
27
-  map(
27
+  lapply(
28 28
     entities,
29
-    gdns::query,
30
-    type = type,
31
-    edns_client_subnet = edns_client_subnet
29
+    query, type = type, edns_client_subnet = edns_client_subnet
32 30
   ) -> results
33 31
 
34
-  results <- set_names(results, entities)
32
+  lapply(seq_along(results), function(idx) {
33
+    if (length(results[[idx]]$Answer) == 0) {
34
+      data.frame(
35
+        entity = entities[idx],
36
+        name = NA_character_,
37
+        type = NA_character_,
38
+        TTL = NA_character_,
39
+        data = NA_character_,
40
+        stringsAsFactors = FALSE
41
+      )
42
+    } else {
43
+      results[[idx]]$Answer$entity <- entities[[idx]]
44
+      results[[idx]]$Answer
45
+    }
46
+  }) -> xlst
35 47
 
36
-  map_df(results, ~.x$Answer, .id = "query")
48
+  xdf <- do.call(rbind.data.frame, xlst)
49
+  class(xdf) <- c("tbl_df", "tbl", "data.frame")
50
+  xdf
37 51
 
38 52
 }

+ 7
- 6
README.Rmd Parādīt failu

@@ -54,19 +54,20 @@ library(gdns)
54 54
 # current verison
55 55
 packageVersion("gdns")
56 56
 
57
-query("rud.is")
57
+str(query("rud.is"))
58 58
 
59
-query("example.com", "255") # "ANY" query
59
+str(query("example.com", "255")) # "ANY" query
60 60
 
61
-query("microsoft.com", "MX")
61
+str(query("microsoft.com", "MX"))
62 62
 
63
-query("google-public-dns-a.google.com", "TXT")
63
+str(query("google-public-dns-a.google.com", "TXT"))
64 64
 
65
-query("apple.com")
65
+str(query("apple.com"))
66 66
 
67
-query("17.142.160.59", "PTR")
67
+str(query("17.142.160.59", "PTR"))
68 68
 
69 69
 hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
70
+
70 71
 gdns::bulk_query(hosts)
71 72
 ```
72 73
 

+ 128
- 308
README.md Parādīt failu

@@ -50,313 +50,133 @@ library(gdns)
50 50
 
51 51
 # current verison
52 52
 packageVersion("gdns")
53
-#> [1] '0.2.1'
54
-
55
-query("rud.is")
56
-#> $Status
57
-#> [1] 0
58
-#> 
59
-#> $TC
60
-#> [1] FALSE
61
-#> 
62
-#> $RD
63
-#> [1] TRUE
64
-#> 
65
-#> $RA
66
-#> [1] TRUE
67
-#> 
68
-#> $AD
69
-#> [1] FALSE
70
-#> 
71
-#> $CD
72
-#> [1] FALSE
73
-#> 
74
-#> $Question
75
-#>      name type
76
-#> 1 rud.is.    1
77
-#> 
78
-#> $Answer
79
-#>      name type TTL            data
80
-#> 1 rud.is.    1 277 104.236.112.222
81
-#> 
82
-#> $Additional
83
-#> list()
84
-#> 
85
-#> $edns_client_subnet
86
-#> [1] "0.0.0.0/0"
87
-
88
-query("example.com", "255") # "ANY" query
89
-#> $Status
90
-#> [1] 0
91
-#> 
92
-#> $TC
93
-#> [1] FALSE
94
-#> 
95
-#> $RD
96
-#> [1] TRUE
97
-#> 
98
-#> $RA
99
-#> [1] TRUE
100
-#> 
101
-#> $AD
102
-#> [1] TRUE
103
-#> 
104
-#> $CD
105
-#> [1] FALSE
106
-#> 
107
-#> $Question
108
-#>           name type
109
-#> 1 example.com.  255
110
-#> 
111
-#> $Answer
112
-#>            name type   TTL
113
-#> 1  example.com.   46 21548
114
-#> 2  example.com.   46 21548
115
-#> 3  example.com.   46  3548
116
-#> 4  example.com.   46     8
117
-#> 5  example.com.   46 21548
118
-#> 6  example.com.   46  3548
119
-#> 7  example.com.   46  3548
120
-#> 8  example.com.   46  3548
121
-#> 9  example.com.   47  3548
122
-#> 10 example.com.    2 21548
123
-#> 11 example.com.    2 21548
124
-#> 12 example.com.   28 21548
125
-#> 13 example.com.    1 21548
126
-#> 14 example.com.   16     8
127
-#> 15 example.com.   16     8
128
-#> 16 example.com.   48  3548
129
-#> 17 example.com.   48  3548
130
-#> 18 example.com.   48  3548
131
-#> 19 example.com.   48  3548
132
-#> 20 example.com.    6  3548
133
-#>                                                                                                                                                                                                                                                                                                                                                                                                                 data
134
-#> 1                                                                                                                                                                                   a 8 2 86400 1530064725 1528271786 4354 example.com. gpgx3XIhF4XZg5Nw0eo7TmCD1zfKX9YtMq9PuSh3eAc4fJrvyS/VWy2bz/KYhgiXQe6PvtOLZbgTT2O9knkHIlAsmnznEowSrgWYaCkkkNnoC8Ii1Ikg87PCZ7FffTposk/4HRG6yXZlo9+++YZAfAC0cc9FFYpQXqxVLf9/aDQ=
135
-#> 2                                                                                                                                                                                  ns 8 2 86400 1530070167 1528286186 4354 example.com. tVZnWX3VxO+XqrDS76S6RpLYvGluZIQkai0aWx3pzjjhqi+qKO7WtjcIYmOgehBB2t3TVC9cv1rhb21SDBZPNtgtpWAR/W3hPK1FA4AhDW3tDwk0vZ8VnxRS6YZRdubY5xx8f+88auYUZNauK3SsAcKj4k9IaeMLinzpie0ydKk=
136
-#> 3                                                                                                                                                                                  soa 8 2 3600 1530144931 1528300586 4354 example.com. oDz3EMYugQZ5zJV2Wwr76heKzbOB8cDgol+HD0DTPPNkBHkU33thZI3kwtD/KE7YFbwlD86is5Qgy4sVOToEcxs6Th2+bxkwkSDbnNCfpqXg9FP2nknfsYdN8UHIOcsbjo8pAEQrwbOBnRhkfgh+B2jXCeR8wcYIDtlfyjIG5dw=
137
-#> 4                                                                                                                                                                                    txt 8 2 60 1530100194 1528250186 4354 example.com. PRVGxCX8Sghw9xQv+ITTpIHbpku543BNEVSA0LZVIZ2p5r3kPb4vlID/jSzFTOhgLhdkB0OAMG3dvWxNXT3fOBiv8c/UZHdwjJdneLeoHILiAa4Y3HSC+t4kcs+9qRFzj4EQgXwr0zWLDoZTa9bkhoVdaC8q+oL+TyjiwgG6RXs=
138
-#> 5                                                                                                                                                                                aaaa 8 2 86400 1528834805 1526975786 4354 example.com. lRAUeTu/Wr7mobPHuh29z66cqqnCQXvUcSWYNsrdJvWIUaaGNUtz800bQQuZah3tZbJeSbDV+LivN8pFYrTPR9AVyTi1uD7x8qH+3MckgKezJ199e1twfbpl0O44zSFlrI7SxEaWhTnUGM2xafyH0HZUr1Eg/5nxDFlmaVfxet8=
139
-#> 6                                                                                                                                                                                 nsec 8 2 3600 1530145868 1528300586 4354 example.com. NV0BbCZT7yXFnrJhEV1atS0QBbkDmojtUw9PIxDOUJzEZtWql5qJ5iMJl2z8ghmRwurnRAskBOZaT1jstyf/X8wBS8T05uc6KgfiFdoeseIWfTd9+9y6E9ESHmsSLDyHlbex6k3XAb5c4GWSyZ058JpSUyQbpnTC0fxEONxiFT4=
140
-#> 7  dnskey 8 2 3600 1530072436 1528278986 31406 example.com. exstuS89vtBrpvN+6XK49NWMrQmUoHJAAMzLMCi5w3xUczvo9hQWi3yfDVk7Rdtv61IFEFRTIVVCoM0kpWmgp1NwOPKNSUxg3OVO5++PGoCE7hI8fhW/xdiOUC1dHHk/zuWRoriERykgNvo6yzegBmXbOyf7WCh1csoGuk+RmIWykngZw9wCX+qjdO1G8y8DMmwzEzDc3fBN9v2at3lo+VK/uhR4Tu6rr4rxkYqqgz02TIkHr14GsCa4hlf8/s2UhaWKil5ja51HgFsR2fLHRwZ1x1toejaxMekJvVcarhNYodU83q8qZ0Yoa8GIKpdS70chj4ZrLiUkBhV2KEtytg==
141
-#> 8  dnskey 8 2 3600 1530072436 1528278986 45620 example.com. Kd2iq2xmcg5GJmNOQiHjZKDKHH+MyDagSjXuTJKiJFXSpgMzZUl9Gnr+LsDTiLaddotsBo3OXQODZDlIB5jlI7/hkt/kYOb8d1ns+hd5jmTyFowhOiQAxpWUlZkvXvVQ5gAnefxGCx78/4JtFnTMGADiAYEIMXZm+qtjn9/YJKtkgmgutxcVjTDAl7zVdvN+uyR5g/f2Rm5x1aWLIfmAtg0Nv5xFKZTduPse8PrKsGHC3uezWRshbOYugOxp/Ui6Ru6PNBaeUBGuKwQw2XcB9H65PE4wj14mcCcQk5wTL8VfeaW6WQ6y+dgtwMGoUCnF2Eaj/5Gnv2mW+1VMv0jIqg==
142
-#> 9                                                                                                                                                                                                                                                                                                                                                               www.example.com. A NS SOA TXT AAAA RRSIG NSEC DNSKEY
143
-#> 10                                                                                                                                                                                                                                                                                                                                                                                               a.iana-servers.net.
144
-#> 11                                                                                                                                                                                                                                                                                                                                                                                               b.iana-servers.net.
145
-#> 12                                                                                                                                                                                                                                                                                                                                                                                2606:2800:220:1:248:1893:25c8:1946
146
-#> 13                                                                                                                                                                                                                                                                                                                                                                                                     93.184.216.34
147
-#> 14                                                                                                                                                                                                                                                                                                                                                                                                     "v=spf1 -all"
148
-#> 15                                                                                                                                                                                                                                                                                                                                                             "$Id: example.com 4415 2015-08-24 20:12:23Z davids $"
149
-#> 16                                                                                                                                                                                                                          256 3 8 AwEAAa1e3aHzKml+EtBvA6ZVztOV+AByi8/9akkbL9COtasbKc1VBbHS6w8uHGqHaEMXzriWtXAwlSzHMgIxJ1y0fXcB/h4Yg8qNnJvgSU1JAKvYLJMkdAk+P5XbdGtpUNCh4d9NEZkY/lFClYo8iyIAVeifDeaeaEQIRKbPZLLwtgr1
150
-#> 17                                                                                                                                                                                                                          256 3 8 AwEAAbpTkuNZuxDDAwDW46cAroMR10zm9MsdVnXT+m/4HtbGstC4LIt8WU3CRayoXZyO6zDwxAytkuKxuEWVCAVA7ligFPR8Ta/BoR91H66dj8OPExAq6ugqKsQDKP906j5cF9Rsr9k0rEjvh2MptStkzCSaBB3FulTj14pBX1MZ8x9n
151
-#> 18                                              257 3 8 AwEAAZ0aqu1rJ6orJynrRfNpPmayJZoAx9Ic2/Rl9VQWLMHyjxxem3VUSoNUIFXERQbj0A9Ogp0zDM9YIccKLRd6LmWiDCt7UJQxVdD+heb5Ec4qlqGmyX9MDabkvX2NvMwsUecbYBq8oXeTT9LRmCUt9KUt/WOi6DKECxoG/bWTykrXyBR8elD+SQY43OAVjlWrVltHxgp4/rhBCvRbmdflunaPIgu27eE2U4myDSLT8a4A0rB5uHG4PkOa9dIRs9y00M2mWf4lyPee7vi5few2dbayHXmieGcaAHrx76NGAABeY393xjlmDNcUkF1gpNWUla4fWZbbaYQzA93mLdrng+M=
152
-#> 19                                              257 3 8 AwEAAbOFAxl+Lkt0UMglZizKEC1AxUu8zlj65KYatR5wBWMrh18TYzK/ig6Y1t5YTWCO68bynorpNu9fqNFALX7bVl9/gybA0v0EhF+dgXmoUfRX7ksMGgBvtfa2/Y9a3klXNLqkTszIQ4PEMVCjtryl19Be9/PkFeC9ITjgMRQsQhmB39eyMYnal+f3bUxKk4fq7cuEU0dbRpue4H/N6jPucXWOwiMAkTJhghqgy+o9FfIp+tR/emKao94/wpVXDcPf5B18j7xz2SvTTxiuqCzCMtsxnikZHcoh1j4g+Y1B8zIMIvrEM+pZGhh/Yuf4RwCBgaYCi9hpiMWVvS4WBzx0/lU=
153
-#> 20                                                                                                                                                                                                                                                                                                                                           sns.dns.icann.org. noc.dns.icann.org. 2018050812 7200 3600 1209600 3600
154
-#> 
155
-#> $Additional
156
-#> list()
157
-#> 
158
-#> $edns_client_subnet
159
-#> [1] "0.0.0.0/0"
160
-
161
-query("microsoft.com", "MX")
162
-#> $Status
163
-#> [1] 0
164
-#> 
165
-#> $TC
166
-#> [1] FALSE
167
-#> 
168
-#> $RD
169
-#> [1] TRUE
170
-#> 
171
-#> $RA
172
-#> [1] TRUE
173
-#> 
174
-#> $AD
175
-#> [1] FALSE
176
-#> 
177
-#> $CD
178
-#> [1] FALSE
179
-#> 
180
-#> $Question
181
-#>             name type
182
-#> 1 microsoft.com.   15
183
-#> 
184
-#> $Answer
185
-#>             name type  TTL                                          data
186
-#> 1 microsoft.com.   15 3599 10 microsoft-com.mail.protection.outlook.com.
187
-#> 
188
-#> $Additional
189
-#> list()
190
-#> 
191
-#> $edns_client_subnet
192
-#> [1] "0.0.0.0/0"
193
-#> 
194
-#> $Comment
195
-#> [1] "Response from 193.221.113.53."
196
-
197
-query("google-public-dns-a.google.com", "TXT")
198
-#> $Status
199
-#> [1] 0
200
-#> 
201
-#> $TC
202
-#> [1] FALSE
203
-#> 
204
-#> $RD
205
-#> [1] TRUE
206
-#> 
207
-#> $RA
208
-#> [1] TRUE
209
-#> 
210
-#> $AD
211
-#> [1] FALSE
212
-#> 
213
-#> $CD
214
-#> [1] FALSE
215
-#> 
216
-#> $Question
217
-#>                              name type
218
-#> 1 google-public-dns-a.google.com.   16
219
-#> 
220
-#> $Answer
221
-#>                              name type   TTL                    data
222
-#> 1 google-public-dns-a.google.com.   16 21599 "http://xkcd.com/1361/"
223
-#> 
224
-#> $Additional
225
-#> list()
226
-#> 
227
-#> $edns_client_subnet
228
-#> [1] "0.0.0.0/0"
229
-#> 
230
-#> $Comment
231
-#> [1] "Response from 216.239.32.10."
232
-
233
-query("apple.com")
234
-#> $Status
235
-#> [1] 0
236
-#> 
237
-#> $TC
238
-#> [1] FALSE
239
-#> 
240
-#> $RD
241
-#> [1] TRUE
242
-#> 
243
-#> $RA
244
-#> [1] TRUE
245
-#> 
246
-#> $AD
247
-#> [1] FALSE
248
-#> 
249
-#> $CD
250
-#> [1] FALSE
251
-#> 
252
-#> $Question
253
-#>         name type
254
-#> 1 apple.com.    1
255
-#> 
256
-#> $Answer
257
-#>         name type  TTL          data
258
-#> 1 apple.com.    1 3592 17.172.224.47
259
-#> 2 apple.com.    1 3592  17.178.96.59
260
-#> 3 apple.com.    1 3592 17.142.160.59
261
-#> 
262
-#> $Additional
263
-#> list()
264
-#> 
265
-#> $edns_client_subnet
266
-#> [1] "0.0.0.0/0"
267
-
268
-query("17.142.160.59", "PTR")
269
-#> $Status
270
-#> [1] 0
271
-#> 
272
-#> $TC
273
-#> [1] FALSE
274
-#> 
275
-#> $RD
276
-#> [1] TRUE
277
-#> 
278
-#> $RA
279
-#> [1] TRUE
280
-#> 
281
-#> $AD
282
-#> [1] FALSE
283
-#> 
284
-#> $CD
285
-#> [1] FALSE
286
-#> 
287
-#> $Question
288
-#>                          name type
289
-#> 1 59.160.142.17.in-addr.arpa.   12
290
-#> 
291
-#> $Answer
292
-#>                           name type TTL                           data
293
-#> 1  59.160.142.17.in-addr.arpa.   12 907                      imac.one.
294
-#> 2  59.160.142.17.in-addr.arpa.   12 907                       mac.one.
295
-#> 3  59.160.142.17.in-addr.arpa.   12 907                  itunes.earth.
296
-#> 4  59.160.142.17.in-addr.arpa.   12 907                     chomp.com.
297
-#> 5  59.160.142.17.in-addr.arpa.   12 907                   iphone.host.
298
-#> 6  59.160.142.17.in-addr.arpa.   12 907                ripmixburn.com.
299
-#> 7  59.160.142.17.in-addr.arpa.   12 907                   yessql.info.
300
-#> 8  59.160.142.17.in-addr.arpa.   12 907               webobjects.info.
301
-#> 9  59.160.142.17.in-addr.arpa.   12 907                     ubnw.info.
302
-#> 10 59.160.142.17.in-addr.arpa.   12 907                 skyvines.info.
303
-#> 11 59.160.142.17.in-addr.arpa.   12 907            shopdifferent.info.
304
-#> 12 59.160.142.17.in-addr.arpa.   12 907                 sherlock.info.
305
-#> 13 59.160.142.17.in-addr.arpa.   12 907              quicktimetv.info.
306
-#> 14 59.160.142.17.in-addr.arpa.   12 907            quicktimelive.info.
307
-#> 15 59.160.142.17.in-addr.arpa.   12 907                 powermac.info.
308
-#> 16 59.160.142.17.in-addr.arpa.   12 907                powerbook.info.
309
-#> 17 59.160.142.17.in-addr.arpa.   12 907                   macosx.info.
310
-#> 18 59.160.142.17.in-addr.arpa.   12 907               appleshare.info.
311
-#> 19 59.160.142.17.in-addr.arpa.   12 907              applescript.info.
312
-#> 20 59.160.142.17.in-addr.arpa.   12 907         applepaysupplies.info.
313
-#> 21 59.160.142.17.in-addr.arpa.   12 907 applepaymerchantsupplies.info.
314
-#> 22 59.160.142.17.in-addr.arpa.   12 907                 applepay.info.
315
-#> 23 59.160.142.17.in-addr.arpa.   12 907             applemasters.info.
316
-#> 24 59.160.142.17.in-addr.arpa.   12 907                appleexpo.info.
317
-#> 25 59.160.142.17.in-addr.arpa.   12 907         applecomputerinc.info.
318
-#> 26 59.160.142.17.in-addr.arpa.   12 907              applecentre.info.
319
-#> 27 59.160.142.17.in-addr.arpa.   12 907                 airtunes.info.
320
-#> 28 59.160.142.17.in-addr.arpa.   12 907                      apple.by.
321
-#> 29 59.160.142.17.in-addr.arpa.   12 907                 apples-msk.ru.
322
-#> 30 59.160.142.17.in-addr.arpa.   12 907                     icloud.se.
323
-#> 31 59.160.142.17.in-addr.arpa.   12 907                     icloud.es.
324
-#> 32 59.160.142.17.in-addr.arpa.   12 907                     icloud.om.
325
-#> 33 59.160.142.17.in-addr.arpa.   12 907                   icloudo.com.
326
-#> 34 59.160.142.17.in-addr.arpa.   12 907                     icloud.ch.
327
-#> 35 59.160.142.17.in-addr.arpa.   12 907                     icloud.fr.
328
-#> 36 59.160.142.17.in-addr.arpa.   12 907                   icloude.com.
329
-#> 37 59.160.142.17.in-addr.arpa.   12 907          camelspaceeffect.com.
330
-#> 38 59.160.142.17.in-addr.arpa.   12 907                 camelphat.com.
331
-#> 39 59.160.142.17.in-addr.arpa.   12 907              alchemysynth.com.
332
-#> 40 59.160.142.17.in-addr.arpa.   12 907                    openni.org.
333
-#> 41 59.160.142.17.in-addr.arpa.   12 907                      swell.am.
334
-#> 42 59.160.142.17.in-addr.arpa.   12 907                  appleweb.net.
335
-#> 43 59.160.142.17.in-addr.arpa.   12 907                     apple.com.
336
-#> 44 59.160.142.17.in-addr.arpa.   12 907        pv-apple-com.apple.com.
337
-#> 45 59.160.142.17.in-addr.arpa.   12 907                     ipad.host.
338
-#> 46 59.160.142.17.in-addr.arpa.   12 907                   appleid.org.
339
-#> 47 59.160.142.17.in-addr.arpa.   12 907                     apple.xyz.
340
-#> 48 59.160.142.17.in-addr.arpa.   12 907           searchads-apple.com.
341
-#> 49 59.160.142.17.in-addr.arpa.   12 907              airport.brussels.
342
-#> 50 59.160.142.17.in-addr.arpa.   12 907                  ipadpro.buzz.
343
-#> 
344
-#> $Additional
345
-#> list()
346
-#> 
347
-#> $edns_client_subnet
348
-#> [1] "0.0.0.0/0"
53
+#> [1] '0.3.1'
54
+
55
+str(query("rud.is"))
56
+#> List of 10
57
+#>  $ Status            : int 0
58
+#>  $ TC                : logi FALSE
59
+#>  $ RD                : logi TRUE
60
+#>  $ RA                : logi TRUE
61
+#>  $ AD                : logi FALSE
62
+#>  $ CD                : logi FALSE
63
+#>  $ Question          :'data.frame':  1 obs. of  2 variables:
64
+#>   ..$ name: chr "rud.is."
65
+#>   ..$ type: int 1
66
+#>  $ Answer            :'data.frame':  1 obs. of  4 variables:
67
+#>   ..$ name: chr "rud.is."
68
+#>   ..$ type: int 1
69
+#>   ..$ TTL : int 3536
70
+#>   ..$ data: chr "104.236.112.222"
71
+#>  $ Additional        : list()
72
+#>  $ edns_client_subnet: chr "0.0.0.0/0"
73
+
74
+str(query("example.com", "255")) # "ANY" query
75
+#> List of 10
76
+#>  $ Status            : int 0
77
+#>  $ TC                : logi FALSE
78
+#>  $ RD                : logi TRUE
79
+#>  $ RA                : logi TRUE
80
+#>  $ AD                : logi TRUE
81
+#>  $ CD                : logi FALSE
82
+#>  $ Question          :'data.frame':  1 obs. of  2 variables:
83
+#>   ..$ name: chr "example.com."
84
+#>   ..$ type: int 255
85
+#>  $ Answer            :'data.frame':  20 obs. of  4 variables:
86
+#>   ..$ name: chr [1:20] "example.com." "example.com." "example.com." "example.com." ...
87
+#>   ..$ type: int [1:20] 6 46 47 46 2 2 46 28 46 1 ...
88
+#>   ..$ TTL : int [1:20] 3566 3566 3566 21566 21566 21566 21566 21566 21566 21566 ...
89
+#>   ..$ data: chr [1:20] "sns.dns.icann.org. noc.dns.icann.org. 2018080123 7200 3600 1209600 3600" "nsec 8 2 3600 1538855995 1537006806 63855 example.com. pFyGCdsJ2uw2FcRlszW1VuM6FRV1rHbBfeBmp/Jaecdth8njienGYt2k"| __truncated__ "www.example.com. A NS SOA TXT AAAA RRSIG NSEC DNSKEY" "ns 8 2 86400 1538826642 1537014006 63855 example.com. U7KJg6I3XylL5aT10B3tHw9MIV8QoHBlmzO3CwghRh4I00ZzF2IgjakMp"| __truncated__ ...
90
+#>  $ Additional        : list()
91
+#>  $ edns_client_subnet: chr "0.0.0.0/0"
92
+
93
+str(query("microsoft.com", "MX"))
94
+#> List of 10
95
+#>  $ Status            : int 0
96
+#>  $ TC                : logi FALSE
97
+#>  $ RD                : logi TRUE
98
+#>  $ RA                : logi TRUE
99
+#>  $ AD                : logi FALSE
100
+#>  $ CD                : logi FALSE
101
+#>  $ Question          :'data.frame':  1 obs. of  2 variables:
102
+#>   ..$ name: chr "microsoft.com."
103
+#>   ..$ type: int 15
104
+#>  $ Answer            :'data.frame':  1 obs. of  4 variables:
105
+#>   ..$ name: chr "microsoft.com."
106
+#>   ..$ type: int 15
107
+#>   ..$ TTL : int 3507
108
+#>   ..$ data: chr "10 microsoft-com.mail.protection.outlook.com."
109
+#>  $ Additional        : list()
110
+#>  $ edns_client_subnet: chr "0.0.0.0/0"
111
+
112
+str(query("google-public-dns-a.google.com", "TXT"))
113
+#> List of 10
114
+#>  $ Status            : int 0
115
+#>  $ TC                : logi FALSE
116
+#>  $ RD                : logi TRUE
117
+#>  $ RA                : logi TRUE
118
+#>  $ AD                : logi FALSE
119
+#>  $ CD                : logi FALSE
120
+#>  $ Question          :'data.frame':  1 obs. of  2 variables:
121
+#>   ..$ name: chr "google-public-dns-a.google.com."
122
+#>   ..$ type: int 16
123
+#>  $ Answer            :'data.frame':  1 obs. of  4 variables:
124
+#>   ..$ name: chr "google-public-dns-a.google.com."
125
+#>   ..$ type: int 16
126
+#>   ..$ TTL : int 21537
127
+#>   ..$ data: chr "\"http://xkcd.com/1361/\""
128
+#>  $ Additional        : list()
129
+#>  $ edns_client_subnet: chr "0.0.0.0/0"
130
+
131
+str(query("apple.com"))
132
+#> List of 10
133
+#>  $ Status            : int 0
134
+#>  $ TC                : logi FALSE
135
+#>  $ RD                : logi TRUE
136
+#>  $ RA                : logi TRUE
137
+#>  $ AD                : logi FALSE
138
+#>  $ CD                : logi FALSE
139
+#>  $ Question          :'data.frame':  1 obs. of  2 variables:
140
+#>   ..$ name: chr "apple.com."
141
+#>   ..$ type: int 1
142
+#>  $ Answer            :'data.frame':  3 obs. of  4 variables:
143
+#>   ..$ name: chr [1:3] "apple.com." "apple.com." "apple.com."
144
+#>   ..$ type: int [1:3] 1 1 1
145
+#>   ..$ TTL : int [1:3] 3557 3557 3557
146
+#>   ..$ data: chr [1:3] "17.172.224.47" "17.178.96.59" "17.142.160.59"
147
+#>  $ Additional        : list()
148
+#>  $ edns_client_subnet: chr "0.0.0.0/0"
149
+
150
+str(query("17.142.160.59", "PTR"))
151
+#> List of 10
152
+#>  $ Status            : int 0
153
+#>  $ TC                : logi FALSE
154
+#>  $ RD                : logi TRUE
155
+#>  $ RA                : logi TRUE
156
+#>  $ AD                : logi FALSE
157
+#>  $ CD                : logi FALSE
158
+#>  $ Question          :'data.frame':  1 obs. of  2 variables:
159
+#>   ..$ name: chr "59.160.142.17.in-addr.arpa."
160
+#>   ..$ type: int 12
161
+#>  $ Answer            :'data.frame':  5 obs. of  4 variables:
162
+#>   ..$ name: chr [1:5] "59.160.142.17.in-addr.arpa." "59.160.142.17.in-addr.arpa." "59.160.142.17.in-addr.arpa." "59.160.142.17.in-addr.arpa." ...
163
+#>   ..$ type: int [1:5] 12 12 12 12 12
164
+#>   ..$ TTL : int [1:5] 2733 2733 2733 2733 2733
165
+#>   ..$ data: chr [1:5] "apple.by." "apple.com." "pv-apple-com.apple.com." "ipad.host." ...
166
+#>  $ Additional        : list()
167
+#>  $ edns_client_subnet: chr "0.0.0.0/0"
349 168
 
350 169
 hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
170
+
351 171
 gdns::bulk_query(hosts)
352
-#>             name type  TTL            data
353
-#> 1        rud.is.    1  276 104.236.112.222
354
-#> 2        dds.ec.    1  599    185.53.178.9
355
-#> 3 r-project.org.    1 4806   137.208.57.37
356
-#> 4   rstudio.com.    1 3599   104.196.200.5
357
-#> 5     apple.com.    1 3585   17.172.224.47
358
-#> 6     apple.com.    1 3585    17.178.96.59
359
-#> 7     apple.com.    1 3585   17.142.160.59
172
+#>             name type  TTL            data        entity
173
+#> 1        rud.is.    1  806 104.236.112.222        rud.is
174
+#> 2        dds.ec.    1  507    185.53.178.9        dds.ec
175
+#> 3 r-project.org.    1 7199   137.208.57.37 r-project.org
176
+#> 4   rstudio.com.    1 3536   104.196.200.5   rstudio.com
177
+#> 5     apple.com.    1 3082   17.172.224.47     apple.com
178
+#> 6     apple.com.    1 3082    17.178.96.59     apple.com
179
+#> 7     apple.com.    1 3082   17.142.160.59     apple.com
360 180
 ```
361 181
 
362 182
 ### Test Results
@@ -366,15 +186,15 @@ library(gdns)
366 186
 library(testthat)
367 187
 
368 188
 date()
369
-#> [1] "Wed Jun  6 15:28:43 2018"
189
+#> [1] "Sat Sep 15 14:29:20 2018"
370 190
 
371 191
 test_dir("tests/")
372 192
 #> ✔ | OK F W S | Context
373
-#> ══ testthat results  ════════════════════════════════════════════════════════════
193
+#> ══ testthat results  ═════════════════════════════════════════════════════════════════════════════════════════
374 194
 #> OK: 2 SKIPPED: 0 FAILED: 0
375 195
 #> 
376
-#> ══ Results ══════════════════════════════════════════════════════════════════════
377
-#> Duration: 0.3 s
196
+#> ══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════
197
+#> Duration: 0.4 s
378 198
 #> 
379 199
 #> OK:       0
380 200
 #> Failed:   0

+ 14
- 0
tools/mk-rsrc-rcrd-tbl.R Parādīt failu

@@ -0,0 +1,14 @@
1
+library(rvest)
2
+library(tidyverse)
3
+
4
+read_html("https://en.wikipedia.org/wiki/List_of_DNS_record_types") %>%
5
+  html_node(xpath=".//table[contains(., 'Address record')]") %>%
6
+  html_table() %>%
7
+  tbl_df() %>%
8
+  janitor::clean_names() %>%
9
+  select(type=2, name=1, description=4, purpose=5) %>%
10
+  filter(name != "ALIAS") %>%
11
+  mutate(type = as.numeric(type)) -> resource_record_tbl
12
+
13
+use_data(resource_record_tbl)
14
+

Notiek ielāde…
Atcelt
Saglabāt