Skip to content

Commit

Permalink
Merge pull request #196 from hannesm/easy
Browse files Browse the repository at this point in the history
adapt to MirageOS 3.7.0 changes
  • Loading branch information
hannesm authored Nov 1, 2019
2 parents 9b41963 + b1d523b commit 6c895bc
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 29 deletions.
14 changes: 14 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
### v4.1.0 (2019-11-01)

* Client improvements (#191 #192 @olleolleolle @linse @cfcs @hannesm in marrakesh September)
- new sublibrary dns.cache providing an LRU cache, mostly copied from resolver
- it uses a LRU cache now (defaults to 32 entries) from dns.cache
- since #195 a mutable LRU.M.t
- tests were added
- Dns_client_flow has been migrated to Dns_client
- various code cleanups (extracted functions), better naming, improved docstrings
- Uflow is now known as Transport
- requires a monotonic clock on creation
* adapt to x509 0.8.0 API changes (#193 @hannesm)
* adapt to newer MirageOS interfaces (#196 @hannesm)

### v4.0.0 (2019-08-15)

* Switch to uDNS implementation, developed from scratch since 2017, primarily
Expand Down
8 changes: 4 additions & 4 deletions dns-certify.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ depends: [
"x509" {>= "0.8.0"}
"lwt" {>= "4.2.1"}
"tls" {>= "0.10.3"}
"mirage-random" {>= "1.2.0"}
"mirage-time-lwt" {>= "1.3.0"}
"mirage-clock-lwt" {>= "2.0.0"}
"mirage-stack-lwt" {>= "1.4.0"}
"mirage-random" {>= "2.0.0"}
"mirage-time" {>= "2.0.0"}
"mirage-clock" {>= "3.0.0"}
"mirage-stack" {>= "2.0.0"}
]

build: [
Expand Down
5 changes: 3 additions & 2 deletions dns-client.opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ depends: [
"domain-name" {>= "0.3.0"}
"ipaddr" {>= "4.0.0"}
"lwt" {>= "4.2.1"}
"mirage-stack-lwt" {>= "1.4.0"}
"mirage-random" {>= "1.2.0"}
"mirage-stack" {>= "2.0.0"}
"mirage-random" {>= "2.0.0"}
"mirage-clock" {>= "3.0.0"}
"mtime" {>= "1.2.0"}
]
synopsis: "Pure DNS resolver API"
Expand Down
2 changes: 1 addition & 1 deletion dns-mirage.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ depends: [
"dns" {= version}
"ipaddr" {>= "4.0.0"}
"lwt" {>= "4.2.1"}
"mirage-stack-lwt" {>= "1.4.0"}
"mirage-stack" {>= "2.0.0"}
]

build: [
Expand Down
8 changes: 4 additions & 4 deletions dns-resolver.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ depends: [
"duration" {>= "0.1.2"}
"randomconv" {>= "0.1.2"}
"lwt" {>= "4.2.1"}
"mirage-time-lwt" {>= "1.3.0"}
"mirage-clock-lwt" {>= "2.0.0"}
"mirage-random" {>= "1.2.0"}
"mirage-stack-lwt" {>= "1.4.0"}
"mirage-time" {>= "2.0.0"}
"mirage-clock" {>= "3.0.0"}
"mirage-random" {>= "2.0.0"}
"mirage-stack" {>= "2.0.0"}
"alcotest" {with-test}
]

Expand Down
6 changes: 3 additions & 3 deletions dns-server.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ depends: [
"randomconv" {>= "0.1.2"}
"duration" {>= "0.1.2"}
"lwt" {>= "4.2.1"}
"mirage-time-lwt" {>= "1.3.0"}
"mirage-clock-lwt" {>= "2.0.0"}
"mirage-stack-lwt" {>= "1.4.0"}
"mirage-time" {>= "2.0.0"}
"mirage-clock" {>= "3.0.0"}
"mirage-stack" {>= "2.0.0"}
"nocrypto" {with-test}
"alcotest" {with-test}
"dns-tsig" {with-test}
Expand Down
2 changes: 1 addition & 1 deletion mirage/certify/dns_certify_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Lwt.Infix
let src = Logs.Src.create "dns_certify_mirage" ~doc:"effectful DNS certify"
module Log = (val Logs.src_log src : Logs.LOG)

module Make (R : Mirage_random.C) (P : Mirage_clock_lwt.PCLOCK) (TIME : Mirage_time_lwt.S) (S : Mirage_stack_lwt.V4) = struct
module Make (R : Mirage_random.S) (P : Mirage_clock.PCLOCK) (TIME : Mirage_time.S) (S : Mirage_stack.V4) = struct

module D = Dns_mirage.Make(S)

Expand Down
2 changes: 1 addition & 1 deletion mirage/certify/dns_certify_mirage.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* (c) 2017, 2018 Hannes Mehnert, all rights reserved *)
module Make (R : Mirage_random.C) (P : Mirage_clock_lwt.PCLOCK) (T : Mirage_time_lwt.S) (S : Mirage_stack_lwt.V4) : sig
module Make (R : Mirage_random.S) (P : Mirage_clock.PCLOCK) (T : Mirage_time.S) (S : Mirage_stack.V4) : sig

val retrieve_certificate :
?ca:[ `Production | `Staging ] ->
Expand Down
2 changes: 1 addition & 1 deletion mirage/certify/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
(name dns_certify_mirage)
(public_name dns-certify.mirage)
(wrapped false)
(libraries dns dns-mirage dns-certify tls lwt duration mirage-random mirage-time-lwt mirage-clock-lwt mirage-stack-lwt))
(libraries dns dns-mirage dns-certify tls lwt duration mirage-random mirage-time mirage-clock mirage-stack))
4 changes: 3 additions & 1 deletion mirage/client/dns_client_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Lwt.Infix
let src = Logs.Src.create "dns_client_mirage" ~doc:"effectful DNS client layer"
module Log = (val Logs.src_log src : Logs.LOG)

module Make (R : Mirage_random.C) (S : Mirage_stack_lwt.V4) = struct
module Make (R : Mirage_random.S) (C : Mirage_clock.MCLOCK) (S : Mirage_stack.V4) = struct

module Transport : Dns_client.S
with type flow = S.TCPV4.flow
Expand Down Expand Up @@ -59,6 +59,8 @@ module Make (R : Mirage_random.C) (S : Mirage_stack_lwt.V4) = struct

include Dns_client.Make(Transport)

let create ?size ?nameserver stack =
create ?size ~rng:R.generate ?nameserver ~clock:C.elapsed_ns stack
end

(*
Expand Down
7 changes: 6 additions & 1 deletion mirage/client/dns_client_mirage.mli
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@

module Make (R : Mirage_random.C) (S : Mirage_stack_lwt.V4) : sig
module Make (R : Mirage_random.S) (C : Mirage_clock.MCLOCK) (S : Mirage_stack.V4) : sig
module Transport : Dns_client.S
with type flow = S.TCPV4.flow
and type io_addr = Ipaddr.V4.t * int
and type +'a io = 'a Lwt.t
and type stack = S.t

include module type of Dns_client.Make(Transport)

val create : ?size:int -> ?nameserver:Transport.ns_addr -> S.t -> t
(** [create ~size ~nameserver stack] uses [R.generate] and [C.elapsed_ns] as
random number generator and timestamp source, and calls the generic
[Dns_client.Make.create]. *)
end

(*
Expand Down
2 changes: 1 addition & 1 deletion mirage/client/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(library
(name dns_client_mirage)
(public_name dns-client.mirage)
(libraries domain-name ipaddr mirage-random mirage-stack-lwt dns-client)
(libraries domain-name ipaddr mirage-random mirage-stack mirage-clock dns-client)
(wrapped false))
2 changes: 1 addition & 1 deletion mirage/dns_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Lwt.Infix
let src = Logs.Src.create "dns_mirage" ~doc:"effectful DNS layer"
module Log = (val Logs.src_log src : Logs.LOG)

module Make (S : Mirage_stack_lwt.V4) = struct
module Make (S : Mirage_stack.V4) = struct

module IS = Set.Make(Ipaddr.V4)

Expand Down
2 changes: 1 addition & 1 deletion mirage/dns_mirage.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* (c) 2017, 2018 Hannes Mehnert, all rights reserved *)

module Make (S : Mirage_stack_lwt.V4) : sig
module Make (S : Mirage_stack.V4) : sig

module IS : Set.S with type elt = Ipaddr.V4.t
(** [IS] is a set of [ipaddr]. *)
Expand Down
2 changes: 1 addition & 1 deletion mirage/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
(name dns_mirage)
(public_name dns-mirage)
(wrapped false)
(libraries dns mirage-stack-lwt ipaddr lwt))
(libraries dns mirage-stack ipaddr lwt))
2 changes: 1 addition & 1 deletion mirage/resolver/dns_resolver_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Lwt.Infix
let src = Logs.Src.create "dns_resolver_mirage" ~doc:"effectful DNS resolver"
module Log = (val Logs.src_log src : Logs.LOG)

module Make (R : Mirage_random.C) (P : Mirage_clock_lwt.PCLOCK) (M : Mirage_clock_lwt.MCLOCK) (TIME : Mirage_time_lwt.S) (S : Mirage_stack_lwt.V4) = struct
module Make (R : Mirage_random.S) (P : Mirage_clock.PCLOCK) (M : Mirage_clock.MCLOCK) (TIME : Mirage_time.S) (S : Mirage_stack.V4) = struct

module Dns = Dns_mirage.Make(S)

Expand Down
2 changes: 1 addition & 1 deletion mirage/resolver/dns_resolver_mirage.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* (c) 2017, 2018 Hannes Mehnert, all rights reserved *)

module Make (R : Mirage_random.C) (P : Mirage_clock_lwt.PCLOCK) (M : Mirage_clock_lwt.MCLOCK) (T : Mirage_time_lwt.S) (S : Mirage_stack_lwt.V4) : sig
module Make (R : Mirage_random.S) (P : Mirage_clock.PCLOCK) (M : Mirage_clock.MCLOCK) (T : Mirage_time.S) (S : Mirage_stack.V4) : sig

val resolver : S.t -> ?root:bool -> ?timer:int -> ?port:int -> Dns_resolver.t -> unit
(** [resolver stack ~root ~timer ~port resolver] registers a caching resolver
Expand Down
2 changes: 1 addition & 1 deletion mirage/resolver/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
(name dns_resolver_mirage)
(public_name dns-resolver.mirage)
(wrapped false)
(libraries dns dns-resolver dns-server dns-mirage lwt duration mirage-time-lwt mirage-clock-lwt mirage-stack-lwt mirage-random))
(libraries dns dns-resolver dns-server dns-mirage lwt duration mirage-time mirage-clock mirage-stack mirage-random))
2 changes: 1 addition & 1 deletion mirage/server/dns_server_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Lwt.Infix
let src = Logs.Src.create "dns_server_mirage" ~doc:"effectful DNS server"
module Log = (val Logs.src_log src : Logs.LOG)

module Make (P : Mirage_clock_lwt.PCLOCK) (M : Mirage_clock_lwt.MCLOCK) (TIME : Mirage_time_lwt.S) (S : Mirage_stack_lwt.V4) = struct
module Make (P : Mirage_clock.PCLOCK) (M : Mirage_clock.MCLOCK) (TIME : Mirage_time.S) (S : Mirage_stack.V4) = struct

module Dns = Dns_mirage.Make(S)

Expand Down
2 changes: 1 addition & 1 deletion mirage/server/dns_server_mirage.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* (c) 2017, 2018 Hannes Mehnert, all rights reserved *)

module Make (P : Mirage_clock_lwt.PCLOCK) (M : Mirage_clock_lwt.MCLOCK) (T : Mirage_time_lwt.S) (S : Mirage_stack_lwt.V4) : sig
module Make (P : Mirage_clock.PCLOCK) (M : Mirage_clock.MCLOCK) (T : Mirage_time.S) (S : Mirage_stack.V4) : sig

val primary : ?on_update:(old:Dns_trie.t -> Dns_server.Primary.s -> unit Lwt.t) ->
?on_notify:([ `Notify of Dns.Soa.t option | `Signed_notify of Dns.Soa.t option ] ->
Expand Down
2 changes: 1 addition & 1 deletion mirage/server/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
(name dns_server_mirage)
(public_name dns-server.mirage)
(wrapped false)
(libraries dns dns-server dns-mirage lwt duration randomconv mirage-time-lwt mirage-clock-lwt mirage-stack-lwt))
(libraries dns dns-server dns-mirage lwt duration randomconv mirage-time mirage-clock mirage-stack))

0 comments on commit 6c895bc

Please sign in to comment.