P2p: add P2p_point.Id.pp_list

This commit is contained in:
Julien Tesson 2018-11-12 13:25:05 +01:00 committed by Grégoire Henry
parent 0557c49c88
commit 9250e3891d
No known key found for this signature in database
GPG Key ID: 50D984F20BD445D2
2 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,7 @@
(* *) (* *)
(* Open Source License *) (* Open Source License *)
(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* Copyright (c) 2019 Nomadic Labs, <contact@nomadic-labs.com> *)
(* *) (* *)
(* Permission is hereby granted, free of charge, to any person obtaining a *) (* Permission is hereby granted, free of charge, to any person obtaining a *)
(* copy of this software and associated documentation files (the "Software"),*) (* copy of this software and associated documentation files (the "Software"),*)
@ -42,6 +43,8 @@ module Id = struct
let pp_opt ppf = function let pp_opt ppf = function
| None -> Format.pp_print_string ppf "none" | None -> Format.pp_print_string ppf "none"
| Some point -> pp ppf point | Some point -> pp ppf point
let pp_list ppf point_list =
Format.pp_print_list ~pp_sep:Format.pp_print_space pp ppf point_list
let is_local (addr, _) = Ipaddr.V6.is_private addr let is_local (addr, _) = Ipaddr.V6.is_private addr
let is_global (addr, _) = not @@ Ipaddr.V6.is_private addr let is_global (addr, _) = not @@ Ipaddr.V6.is_private addr

View File

@ -32,6 +32,7 @@ module Id : sig
val pp : Format.formatter -> t -> unit val pp : Format.formatter -> t -> unit
val pp_opt : Format.formatter -> t option -> unit val pp_opt : Format.formatter -> t option -> unit
val pp_list : Format.formatter -> t list -> unit
val of_string_exn : string -> t val of_string_exn : string -> t
val of_string : string -> (t, string) result val of_string : string -> (t, string) result