x <- ip_address(c("192.168.0.1", "2001:db8::8a2e:370:7334", NA))
ip_to_bytes(x)
bytes <- list(
as.raw(c(0xc0, 0xa8, 0x00, 0x01)),
as.raw(c(
0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x34
)),
NULL
)
bytes_to_ip(bytes)
Run the code above in your browser using DataLab