-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
87 lines (60 loc) · 1.83 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
output: rmarkdown::github_document
editor_options:
chunk_output_type: console
---
# inet
Higher-order Internet Protocol ('IP') Address Methods
## Description
A collection of tools and methods that expand upon the functionality
of the 'iptools' package.
## NOTE
Currently uses `Remotes:` in the `DESCRIPTION` since it depends on the _development version_ of `iptools`.
## What's Inside The Tin
The following functions are implemented:
- `as.ipv4`: Convert a character vector of IP(v4) addresses into an 'ipv4' object
- `as.numeric`: Convert an IPv4 object to an numeric vector
- `decode_toredo`: Decode Toredo IPv6 strings into components
- `enrich`: Enrich a collection of IP addresses with country and AS information
- `in_addr_arpa`: Convert IPv4 addresses into in-addr.arpa format
- `ipv4_to_ipv6`: Perform 6-to-4 and 4-to-6 addressing
- `ipv6_to_ipv4`: Perform 6-to-4 and 4-to-6 addressing
- `octets`: Turn an IPv4 object or a character vector of IPv4 addresses into a data frame of octets
## Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/iptools")
devtools::install_github("hrbrmstr/inet")
```
```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}
options(width=120)
```
## Usage
```{r message=FALSE, warning=FALSE, error=FALSE}
library(inet)
library(tidyverse)
# current verison
packageVersion("inet")
```
```{r}
set.seed(19216811)
x <- iptools::ip_random(20)
x <- as.ipv4(x)
as.numeric(x)
enrich(x)
octets(x)
in_addr_arpa(x)
```
### [RFC 3056](https://tools.ietf.org/html/rfc3056>) 6-to-4 / 4-to-6 encoding
```{r}
set.seed(19216811)
data_frame(
src = iptools::ip_random(10),
to6 = ipv4_to_ipv6(src),
to4 = ipv6_to_ipv4(to6),
equal = (src == to4)
)
```
### [RFC 4380](https://tools.ietf.org/html/rfc4380) Teredo IPv6 Decoding
```{r}
decode_toredo("2001:0000:4136:e378:8000:63bf:3fff:fdd2")
```