Net.Ipaddr
IP addresses.
The raw bytes of the IP address. It is either 4 bytes long (for an IPv4 address) or 16 bytes long (for IPv6).
module V4 : sig ... end
IPv4 addresses.
module V6 : sig ... end
IPv6 addresses.
pp
formats IP addresses. For IPv6 addresses, it follows http://tools.ietf.org/html/rfc5952.
type v4v6 = [ `V4 | `V6 ] t
fold ~v4 ~v6 t
is v4 t
if t
is an IPv4 address, or v6 t
if it's an IPv6 address.
To convert to or from OCaml Unix addresses, use Eio_unix.Ipaddr
.
To interoperate with the ipaddr library:
Ipaddr.to_octets ipaddr_ip |> Eio.Net.Ipaddr.of_raw
Ipaddr.of_octets_exn (eio_ip :> string)
val of_raw : string -> v4v6
of_raw addr
casts addr
to an IP address.