---
output: rmarkdown::github_document
editor_options: 
  chunk_output_type: console
---
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
```

```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
```

```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```

## What's Inside The Tin

The following functions are implemented:

```{r ingredients, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::describe_ingredients()
```

## Installation

There is now a Golang dependency, which means you're better off doing:

```
git clone --recurse-submodules -j8 git@github.com:hrbrmstr/pwhois.git
```

and building from RStudio or the command line.

## Usage

```{r lib-ex}
library(pwhois)

# current version
packageVersion("pwhois")

```

A basic query:

```{ex-01}
(res <- whois("17.253.144.10"))

str(tidy_pwhois(res), 1)
```

The Prefix WhoIs project supports some advanced queries including the ability to search on any of their WHOIS registry fields:

```{r ex-02}
(res <- whois("registry org-name=apple, inc"))

tibble::as_tibble(tidy_pwhois(res))
```

and can return results in different formats including Team Cymru tables:

```{r ex-03}
(res <- whois('type=cymru 17.253.144.10'))

str(tidy_cymru(res), 1)
```

That `tidy_cymru()` function can be used on responses from the Team Cymru 
WHOIS service as well:

```{r ex-03a}
(res <- whois('-v AS23028', "whois.cymru.com"))

str(tidy_cymru(res))
```

The Prefix WhoIs project can also return responses in Routing Policy Specification Language (RPSL), but there is no 'tidy' function for this format yet:

```{r ex-04}
whois('type=rpsl 17.253.144.10') 
```

Old-school WHOIS

```{r ex-05}
str(pwhois::whois_query("r-project.org"), 2)
```

## pwhois Metrics

```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
```

## Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. 
By participating in this project you agree to abide by its terms.
