From ae9d67eb8ab38e51f0b71816a029d9de439587cd Mon Sep 17 00:00:00 2001 From: Jeltz Date: Wed, 7 Sep 2022 06:21:56 +0200 Subject: [PATCH] Parse single IP addresses --- config.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config.ml b/config.ml index 9eaa695..21cc483 100644 --- a/config.ml +++ b/config.ml @@ -16,7 +16,13 @@ module Zone = struct let rec of_json = function | `String str -> str |> V6.Prefix.of_string |> Result.map ipv6 + &?> (str |> V6.of_string + |> Result.map V6.Prefix.of_addr + |> Result.map ipv6) &?> (str |> V4.Prefix.of_string |> Result.map ipv4) + &?> (str |> V4.of_string + |> Result.map V4.Prefix.of_addr + |> Result.map ipv4) &> (str |> name) | `Assoc [ ("not", json) ] -> Not (of_json json) | `List list -> List (List.map of_json list) @@ -34,7 +40,9 @@ module Addrs = struct let open Yojson.Basic.Util in let str = json |> to_string in str |> V6.Prefix.of_string |> Result.map ipv6 + &?> (str |> V6.of_string |> Result.map V6.Prefix.of_addr |> Result.map ipv6) &?> (str |> V4.Prefix.of_string |> Result.map ipv4) + &?> (str |> V4.of_string |> Result.map V4.Prefix.of_addr |> Result.map ipv4) &> (str |> name) end