Skip to content

Commit

Permalink
Merge pull request #416 from hannesm/dns-6.4.0
Browse files Browse the repository at this point in the history
adapt to dns-client 6.4.0 changes
  • Loading branch information
hannesm authored Oct 25, 2022
2 parents 20cbe19 + 638c173 commit eec7b0b
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 0.19.0
version = 0.23.0
profile = conventional
break-infix = fit-or-vertical
parse-docstrings = true
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v6.0.1 (2022-10-25)

* conduit-mirage: adapt to dns 6.4.0 changes, Resolver_mirage.v is now in Lwt.t
monad (#416 @hannesm)

## v6.0.0 (2022-10-11)

* conduit-mirage: delay parsing of nameservers (#415 @reynir, review by @dinosaure)
Expand Down
2 changes: 1 addition & 1 deletion conduit-mirage.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ depends: [
"mirage-flow-combinators" {>= "2.0.0"}
"mirage-random" {>= "2.0.0"}
"mirage-time" {>= "2.0.0"}
"dns-client" {>= "6.2.0"}
"dns-client" {>= "6.4.0"}
"conduit-lwt" {=version}
"vchan" {>= "5.0.0"}
"xenstore"
Expand Down
2 changes: 1 addition & 1 deletion src/conduit-async/v2.dummy.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ include
and type ssl_conn = [ `Ssl_not_compiled_in ]
and type ssl_opt = [ `Ssl_not_compiled_in ]
and type allowed_ciphers =
[ `Only of string list | `Openssl_default | `Secure ]
[ `Only of string list | `Openssl_default | `Secure ]
2 changes: 1 addition & 1 deletion src/conduit-async/v2.real.mli
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ include
and type ssl_opt = Ssl.Opt.t
and type verify_mode = Ssl.Verify_mode.t
and type allowed_ciphers =
[ `Only of string list | `Openssl_default | `Secure ]
[ `Only of string list | `Openssl_default | `Secure ]
2 changes: 1 addition & 1 deletion src/conduit-async/v3.dummy.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ include
and type ssl_conn = [ `Ssl_not_compiled_in ]
and type ssl_opt = [ `Ssl_not_compiled_in ]
and type allowed_ciphers =
[ `Only of string list | `Openssl_default | `Secure ]
[ `Only of string list | `Openssl_default | `Secure ]
2 changes: 1 addition & 1 deletion src/conduit-async/v3.real.mli
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ include
and type ssl_opt = Ssl.Opt.t
and type verify_mode = Ssl.Verify_mode.t
and type allowed_ciphers =
[ `Only of string list | `Openssl_default | `Secure ]
[ `Only of string list | `Openssl_default | `Secure ]
18 changes: 2 additions & 16 deletions src/conduit-mirage/resolver_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,8 @@ struct
| Ok addr -> `TCP (Ipaddr.V4 addr, port)

let register ?nameservers s res =
let ( let* ) = Result.bind in
(* DNS stub resolver *)
let* nameservers =
Option.fold ~none:(Ok None)
~some:(fun nameservers ->
List.fold_left
(fun acc ns ->
let* acc = acc in
let* ns = DNS.nameserver_of_string ns in
Ok (ns :: acc))
(Ok []) nameservers
|> Result.map Option.some)
nameservers
|> Result.map (Option.map (fun io -> (`Tcp, io)))
in
let dns = DNS.create ?nameservers s in
DNS.connect ?nameservers s >|= fun dns ->
let f = dns_stub_resolver dns in
Resolver_lwt.add_rewrite ~host:"" ~f res;
let service = Resolver_lwt.(service res ++ static_service) in
Expand All @@ -139,7 +125,7 @@ struct

let v ?nameservers stack =
let res = Resolver_lwt.init () in
register ?nameservers stack res |> Result.map (fun () -> res)
register ?nameservers stack res >|= Result.map (fun () -> res)

type t = Resolver_lwt.t
end
3 changes: 2 additions & 1 deletion src/conduit-mirage/resolver_mirage.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ module Make
(S : Tcpip.Stack.V4V6) : sig
include S

val v : ?nameservers:string list -> S.t -> (t, [> `Msg of string ]) result
val v :
?nameservers:string list -> S.t -> (t, [> `Msg of string ]) result Lwt.t
(** [v ~nameservers stack ()] TODO. An error is returned if any of the
nameserver specifications do not parse. *)
end
3 changes: 2 additions & 1 deletion tests/conduit-mirage/vchan/config_client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ let main = foreign "Unikernel.Client" (time @-> job)
let () =
register
~libraries:[ "conduit.mirage"; "vchan.xen" ]
~packages:[ "conduit"; "vchan" ] "vchan_client" [ main $ default_time ]
~packages:[ "conduit"; "vchan" ] "vchan_client"
[ main $ default_time ]
3 changes: 2 additions & 1 deletion tests/conduit-mirage/vchan/config_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ let main = foreign "Unikernel.Server" (time @-> job)
let () =
register
~libraries:[ "conduit.mirage"; "vchan.xen" ]
~packages:[ "conduit"; "vchan" ] "vchan_server" [ main $ default_time ]
~packages:[ "conduit"; "vchan" ] "vchan_server"
[ main $ default_time ]

0 comments on commit eec7b0b

Please sign in to comment.