package devkit

  1. Overview
  2. Docs

Manipulating network addresses

type ipv4
type ipv4_cidr
exception Parse_ipv4 of string
val ipv4_null : ipv4
val bytes_of_ipv4 : ipv4 -> int * int * int * int
val string_of_ipv4 : ipv4 -> string
val ipv4_of_string_exn : string -> ipv4
val ipv4_of_string_null : string -> ipv4
  • returns

    ip 0.0.0.0 when input is not an IP

val ipv4_of_int32 : int32 -> ipv4
val int32_of_ipv4 : ipv4 -> int32
val is_ipv4_slow : string -> bool
val is_ipv4 : string -> bool
val ipv4_of_int : int -> ipv4
val int_of_ipv4 : ipv4 -> int
val class_c : ipv4 -> ipv4
val ipv4_to_yojson : ipv4 -> Yojson.Safe.t
val ipv4_of_yojson : Yojson.Safe.t -> (ipv4, string) Stdlib.result
module IPv4 : sig ... end
val cidr_of_string_exn : string -> ipv4_cidr

accepts addr/n notation or single ip

val string_of_cidr : ipv4_cidr -> string
val range_of_cidr : ipv4_cidr -> ipv4 * ipv4
val prefix_of_cidr : ipv4_cidr -> ipv4
val ipv4_matches : ipv4 -> ipv4_cidr -> bool
val is_ipv4_special : ipv4 -> bool
val special_cidr : ipv4_cidr list
val private_ipv4_network_ip : unit -> Unix.inet_addr
  • returns

    ip address of this machine on private network, with 127.0.0.1 as a fallback, NB ipv4 only

val public_ipv4_network_ip : unit -> Unix.inet_addr option
val public_ipv4_network_ip_exn : unit -> Unix.inet_addr
val public_ipv4_network_ips : unit -> (string * Unix.inet_addr) list
  • returns

    interfaces and associated ip addresses of this machine on public network. NB ipv4 only

val private_ipv4_network_ips : unit -> (string * Unix.inet_addr) list
  • returns

    interfaces and associated ip addresses of this machine on private network. NB ipv4 only

val private_network_ip : unit -> Unix.inet_addr
  • deprecated use private_ipv4_network_ip instead
val public_network_ips : unit -> (string * Unix.inet_addr) list
  • deprecated use public_ipv4_network_ips instead
val private_network_ips : unit -> (string * Unix.inet_addr) list
  • deprecated use private_ipv4_network_ips instead
OCaml

Innovation. Community. Security.