diff --git a/src/bin_node/node_run_command.ml b/src/bin_node/node_run_command.ml index 14018ca77..578814edf 100644 --- a/src/bin_node/node_run_command.ml +++ b/src/bin_node/node_run_command.ml @@ -50,7 +50,7 @@ let () = "The node is configured to listen on a public address (%a), \ while only 'private' networks are authorised with `--sandbox`. See `%s run --help` on how to change the listening address." - Ipaddr.V6.pp_hum addr Sys.argv.(0) + Ipaddr.V6.pp addr Sys.argv.(0) end Data_encoding.(obj1 (req "addr" P2p_addr.encoding)) (function Non_private_sandbox addr -> Some addr | _ -> None) diff --git a/src/lib_base/p2p_addr.ml b/src/lib_base/p2p_addr.ml index 90dcf8477..d9139c4b5 100644 --- a/src/lib_base/p2p_addr.ml +++ b/src/lib_base/p2p_addr.ml @@ -46,15 +46,15 @@ type port = int let pp ppf addr = match Ipaddr.v4_of_v6 addr with | Some addr -> - Format.fprintf ppf "%a" Ipaddr.V4.pp_hum addr + Format.fprintf ppf "%a" Ipaddr.V4.pp addr | None -> - Format.fprintf ppf "[%a]" Ipaddr.V6.pp_hum addr + Format.fprintf ppf "[%a]" Ipaddr.V6.pp addr let of_string_opt str = - Option.map (Ipaddr.of_string str) ~f:begin function - | Ipaddr.V4 addr -> Ipaddr.v6_of_v4 addr - | V6 addr -> addr - end + match Ipaddr.of_string str with + | Ok (Ipaddr.V4 addr) -> Some (Ipaddr.v6_of_v4 addr) + | Ok (V6 addr) -> Some addr + | Error (`Msg _) -> None let of_string_exn str = match of_string_opt str with diff --git a/src/lib_base/p2p_connection.ml b/src/lib_base/p2p_connection.ml index 6a2cab77b..b63282492 100644 --- a/src/lib_base/p2p_connection.ml +++ b/src/lib_base/p2p_connection.ml @@ -36,9 +36,9 @@ module Id = struct let pp ppf (addr, port) = match port with | None -> - Format.fprintf ppf "[%a]:??" Ipaddr.V6.pp_hum addr + Format.fprintf ppf "[%a]:??" Ipaddr.V6.pp addr | Some port -> - Format.fprintf ppf "[%a]:%d" Ipaddr.V6.pp_hum addr port + Format.fprintf ppf "[%a]:%d" Ipaddr.V6.pp addr port let pp_opt ppf = function | None -> Format.pp_print_string ppf "none" | Some point -> pp ppf point diff --git a/src/lib_base/p2p_point.ml b/src/lib_base/p2p_point.ml index 478de2860..6bd562a7c 100644 --- a/src/lib_base/p2p_point.ml +++ b/src/lib_base/p2p_point.ml @@ -36,9 +36,9 @@ module Id = struct let pp ppf (addr, port) = match Ipaddr.v4_of_v6 addr with | Some addr -> - Format.fprintf ppf "%a:%d" Ipaddr.V4.pp_hum addr port + Format.fprintf ppf "%a:%d" Ipaddr.V4.pp addr port | None -> - Format.fprintf ppf "[%a]:%d" Ipaddr.V6.pp_hum addr port + Format.fprintf ppf "[%a]:%d" Ipaddr.V6.pp addr port let pp_opt ppf = function | None -> Format.pp_print_string ppf "none" | Some point -> pp ppf point diff --git a/src/lib_base/tezos-base.opam b/src/lib_base/tezos-base.opam index 058b04909..1882940b1 100644 --- a/src/lib_base/tezos-base.opam +++ b/src/lib_base/tezos-base.opam @@ -16,7 +16,7 @@ depends: [ "tezos-rpc" "calendar" "ezjsonm" { >= "0.5.0" } - "ipaddr" + "ipaddr" { >= "3.0.0" } "mtime" { >= "1.0.0" } "re" { >= "1.7.2" } ] diff --git a/src/lib_p2p/p2p_acl.ml b/src/lib_p2p/p2p_acl.ml index ce0ef2cac..27278d2e4 100644 --- a/src/lib_p2p/p2p_acl.ml +++ b/src/lib_p2p/p2p_acl.ml @@ -111,7 +111,7 @@ module PatriciaTree(V:HashPtree.Value) = struct let lst = fold (fun p _ l -> p :: l) t [] in Format.fprintf ppf "@[<2>[%a]@]" Format.(pp_print_list ~pp_sep:(fun ppf () -> fprintf ppf ";@ ") - Ipaddr.V6.Prefix.pp_hum) + Ipaddr.V6.Prefix.pp) lst end diff --git a/src/lib_p2p/test/test_p2p_ipv6set.ml b/src/lib_p2p/test/test_p2p_ipv6set.ml index f5c9dd3ea..2cb96445e 100644 --- a/src/lib_p2p/test/test_p2p_ipv6set.ml +++ b/src/lib_p2p/test/test_p2p_ipv6set.ml @@ -110,12 +110,12 @@ let test_fold _ = let print_pset ppf pset = PSet.iter (fun p -> - Format.fprintf ppf "%a " Ipaddr.V6.Prefix.pp_hum p + Format.fprintf ppf "%a " Ipaddr.V6.Prefix.pp p ) pset let print_list ppf l = List.iter (fun p -> - Format.fprintf ppf "%a " Ipaddr.V6.Prefix.pp_hum p + Format.fprintf ppf "%a " Ipaddr.V6.Prefix.pp p ) l let test_to_list _ = diff --git a/src/lib_stdlib_unix/lwt_utils_unix.ml b/src/lib_stdlib_unix/lwt_utils_unix.ml index 2225e93f4..3c95ad6d9 100644 --- a/src/lib_stdlib_unix/lwt_utils_unix.ml +++ b/src/lib_stdlib_unix/lwt_utils_unix.ml @@ -285,8 +285,8 @@ module Socket = struct let handle_litteral_ipv6 host = (* To strip '[' and ']' when a litteral IPv6 is provided *) match Ipaddr.of_string host with - | None -> host - | Some ipaddr -> Ipaddr.to_string ipaddr + | Error (`Msg _) -> host + | Ok ipaddr -> Ipaddr.to_string ipaddr let connect = function | Unix path -> diff --git a/src/lib_stdlib_unix/tezos-stdlib-unix.opam b/src/lib_stdlib_unix/tezos-stdlib-unix.opam index b70718cfc..62cf0ef2a 100644 --- a/src/lib_stdlib_unix/tezos-stdlib-unix.opam +++ b/src/lib_stdlib_unix/tezos-stdlib-unix.opam @@ -11,7 +11,7 @@ depends: [ "tezos-base" "lwt" { >= "3.0.0" } "conf-libev" - "ipaddr" + "ipaddr" { >= "3.0.0" } ] build: [ [ "dune" "build" "-p" name "-j" jobs ]