r-lib / pingr

ICMP and TCP ping and related tools
http://r-lib.github.io/pingr/
Other
33 stars 8 forks source link

Add support for parsing SRV records to nsl() #16

Open davidski opened 4 years ago

davidski commented 4 years ago

Could support for parsing SRV records be added to nsl()?

I've been looking for a self-contained way to query SRV records, ultimately to enable shiny apps to find plumber API endpoints in a micro-services environment. pingr::nsl() is allllmost there. 😄

gaborcsardi commented 4 years ago

What happens with SRV records currently?

davidski commented 4 years ago

Hi!

As a non-supported DNS type, a raw vector is returned. Getting parsing into nsl() to enable easy extraction of the values of the record (target, port, and weight) would be awesome!

pingr::nsl(domain = "_http._tcp.mxtoolbox.com", type = 33L)
#> $answer
#>                       name class type  ttl
#> 1 _http._tcp.mxtoolbox.com     1   33 3600
#>                                                                                 data
#> 1 00, 0a, 00, 64, 00, 50, 09, 6d, 78, 74, 6f, 6f, 6c, 62, 6f, 78, 03, 63, 6f, 6d, 00
#> 
#> $flags
#>    aa    tc    rd    ra    ad    cd 
#> FALSE FALSE  TRUE  TRUE FALSE FALSE

Created on 2020-07-07 by the reprex package (v0.3.0)

gaborcsardi commented 4 years ago

Right. I think we could have a parse_record() function. Or just start returning a proper list in $data, I doubt that many people currently rely on $data being a raw vector for type 33.

I am not very familiar these records, unfortunately, so help is welcome.