Skip to content

Commit 35deb3e

Browse files
committed
Expose a module type instead of a module shared between dns-mirage-{resolver,stub} and expose into dns-resolver.shared few modules such as Dns_root, Dns_metrics or Dns_block
1 parent 3990bab commit 35deb3e

File tree

8 files changed

+40
-26
lines changed

8 files changed

+40
-26
lines changed

mirage/resolver/dns_resolver_mirage.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ module Make (S : Tcpip.Stack.V4V6) : sig
1212
to 853) using the [resolver] configuration. The [timer] is in milliseconds
1313
and defaults to 500 milliseconds.*)
1414

15-
include module type of Dns_resolver_mirage_shared with type t := t
15+
include Dns_resolver_mirage_shared.S with type t := t
1616
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(* (c) 2017, 2018 Hannes Mehnert, all rights reserved *)
2+
3+
module type S = sig
4+
type t
5+
6+
val resolve_external : t -> Ipaddr.t * int -> string -> (int32 * string) Lwt.t
7+
val primary_data : t -> Dns_trie.t
8+
val update_primary_data : t -> Dns_trie.t -> unit
9+
val update_tls : t -> Tls.Config.server -> unit
10+
end
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
(* (c) 2017, 2018 Hannes Mehnert, all rights reserved *)
22

3-
type t
4-
5-
val resolve_external : t -> Ipaddr.t * int -> string -> (int32 * string) Lwt.t
6-
(** [resolve_external t (ip, port) data] resolves for [(ip, port)] the query
7-
[data] and returns a pair of the minimum TTL and a response. *)
8-
9-
val primary_data : t -> Dns_trie.t
10-
(** [primary_data t] is the DNS trie of the primary for the resolver [t]. *)
11-
12-
val update_primary_data : t -> Dns_trie.t -> unit
13-
(** [update_primary_data t data] updates the primary for the resolver [t]
14-
with the DNS trie [data]. Any 'notify's to secondaries are discarded -
15-
secondary name servers are not supported in this setup. *)
16-
17-
val update_tls : t -> Tls.Config.server -> unit
18-
(** [update_tls t tls_config] updates the tls configuration to [tls_config].
19-
If the resolver wasn't already listening for TLS connections it will
20-
start listening. *)
3+
module type S = sig
4+
type t
5+
6+
val resolve_external : t -> Ipaddr.t * int -> string -> (int32 * string) Lwt.t
7+
(** [resolve_external t (ip, port) data] resolves for [(ip, port)] the query
8+
[data] and returns a pair of the minimum TTL and a response. *)
9+
10+
val primary_data : t -> Dns_trie.t
11+
(** [primary_data t] is the DNS trie of the primary for the resolver [t]. *)
12+
13+
val update_primary_data : t -> Dns_trie.t -> unit
14+
(** [update_primary_data t data] updates the primary for the resolver [t]
15+
with the DNS trie [data]. Any 'notify's to secondaries are discarded -
16+
secondary name servers are not supported in this setup. *)
17+
18+
val update_tls : t -> Tls.Config.server -> unit
19+
(** [update_tls t tls_config] updates the tls configuration to [tls_config].
20+
If the resolver wasn't already listening for TLS connections it will
21+
start listening. *)
22+
end

mirage/resolver/dune

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
(public_name dns-resolver.mirage)
44
(wrapped false)
55
(modules dns_resolver_mirage)
6-
(libraries dns dns-resolver dns-server dns-mirage lwt duration mirage-sleep mirage-ptime mirage-mtime tcpip mirage-crypto-rng tls tls-mirage ca-certs-nss dns-resolver.shared))
6+
(libraries dns dns-resolver dns-server dns-mirage lwt duration mirage-sleep mirage-ptime mirage-mtime tcpip mirage-crypto-rng tls tls-mirage ca-certs-nss dns-resolver.mirage.shared))
77

88
(library
99
(name dns_resolver_mirage_shared)
10-
(public_name dns-resolver.shared)
10+
(public_name dns-resolver.mirage.shared)
1111
(wrapped false)
1212
(modules dns_resolver_mirage_shared)
13-
(modules_without_implementation dns_resolver_mirage_shared)
1413
(libraries ipaddr dns-server tcpip tls))

mirage/stub/dns_stub_mirage.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ module Make (S : Tcpip.Stack.V4V6) : sig
2424
to 853) using the [resolver] configuration. The [timer] is in milliseconds
2525
and defaults to 500 milliseconds.*)
2626

27-
include module type of Dns_resolver_mirage_shared with type t := t
27+
include Dns_resolver_mirage_shared.S with type t := t
2828
end

mirage/stub/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
(name dns_stub_mirage)
33
(public_name dns-stub.mirage)
44
(wrapped false)
5-
(libraries dns dns-server dns-tsig metrics dns_resolver_shared dns-resolver.shared dns-mirage dns-client-mirage lwt mirage-ptime tcpip mirage-crypto-rng tls-mirage))
5+
(libraries dns dns-server dns-tsig metrics dns_resolver_shared dns-resolver.mirage.shared dns-mirage dns-client-mirage lwt mirage-ptime tcpip mirage-crypto-rng tls-mirage))

resolver/dns_resolver_shared.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Root = Dns_resolver_root
2+
module Metrics = Dns_resolver_metrics
3+
module Block = Dns_block

resolver/dune

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
(library
1111
(name dns_resolver_shared)
12-
(package dns-resolver)
12+
(public_name dns-resolver.shared)
1313
(wrapped false)
14-
(modules dns_resolver_root dns_block dns_resolver_metrics)
14+
(modules dns_resolver_shared dns_resolver_root dns_block dns_resolver_metrics)
1515
(libraries dns dns-server metrics))

0 commit comments

Comments
 (0)