remove functors

This commit is contained in:
Hannes Mehnert 2025-02-10 15:03:30 +01:00
parent 13c591b58e
commit b17532d2c7
6 changed files with 9 additions and 18 deletions

View file

@ -11,19 +11,18 @@ depends: [
"dune" {>= "2.3"} "dune" {>= "2.3"}
"ocaml" {>= "4.11.0"} "ocaml" {>= "4.11.0"}
"paf" {>= "0.2.0"} "paf" {>= "0.2.0"}
"mirage-clock" {>= "4.0.0"}
"mirage-time" {>= "3.0.0"}
"tcpip" {>= "7.0.0"} "tcpip" {>= "7.0.0"}
"lwt" {>= "5.5.0"} "lwt" {>= "5.5.0"}
"mimic-happy-eyeballs" {>= "0.0.9"} "mimic-happy-eyeballs" {>= "0.0.9"}
"httpaf" "httpaf"
"alcotest-lwt" {with-test & >= "1.0.0"} "alcotest-lwt" {with-test & >= "1.0.0"}
"mirage-clock-unix" {with-test & >= "4.0.0"}
"mirage-crypto-rng" {with-test} "mirage-crypto-rng" {with-test}
"mirage-time-unix" {with-test & >= "3.0.0"} "dns-client-mirage" {with-test & >= "10.0.0"}
"happy-eyeballs-mirage" {with-test & >= "2.0.0"}
"h2" {>= "0.10.0"} "h2" {>= "0.10.0"}
"tls" {>= "1.0.0"} "tls" {>= "1.0.0"}
"x509" {>= "1.0.0"} "x509" {>= "1.0.0"}
"ca-certs-nss" {>= "3.108-1"}
] ]
build: [ build: [
["dune" "subst"] {dev} ["dune" "subst"] {dev}

View file

@ -1,4 +1,4 @@
(library (library
(name http_mirage_client) (name http_mirage_client)
(public_name http-mirage-client) (public_name http-mirage-client)
(libraries paf mirage-clock x509 tcpip mimic-happy-eyeballs httpaf h2)) (libraries paf x509 tcpip mimic-happy-eyeballs httpaf h2 ca-certs-nss))

View file

@ -22,7 +22,6 @@ module type S = sig
end end
module Make module Make
(Pclock : Mirage_clock.PCLOCK)
(TCP : Tcpip.Tcp.S) (TCP : Tcpip.Tcp.S)
(Happy_eyeballs : Mimic_happy_eyeballs.S with type flow = TCP.flow) : S = (Happy_eyeballs : Mimic_happy_eyeballs.S with type flow = TCP.flow) : S =
struct struct
@ -86,9 +85,7 @@ struct
| Error _ -> None) | Error _ -> None)
| _ -> None | _ -> None
let authenticator = let authenticator = Ca_certs_nss.authenticator ()
let module V = Ca_certs_nss.Make (Pclock) in
V.authenticator ()
let connect ctx = let connect ctx =
let k0 happy_eyeballs http_scheme http_hostname http_port = let k0 happy_eyeballs http_scheme http_hostname http_port =

View file

@ -7,7 +7,6 @@ module type S = sig
end end
module Make module Make
(Pclock : Mirage_clock.PCLOCK)
(TCP : Tcpip.Tcp.S) (TCP : Tcpip.Tcp.S)
(Happy_eyeballs : Mimic_happy_eyeballs.S with type flow = TCP.flow) : S (Happy_eyeballs : Mimic_happy_eyeballs.S with type flow = TCP.flow) : S

View file

@ -1,8 +1,7 @@
(executable (executable
(name test) (name test)
(libraries fmt.tty logs.fmt http-mirage-client tcpip.stack-socket paf.mirage (libraries fmt.tty logs.fmt http-mirage-client tcpip.stack-socket paf.mirage
mirage-clock-unix mirage-crypto-rng mirage-time-unix mimic-happy-eyeballs mirage-crypto-rng mimic-happy-eyeballs alcotest-lwt))
alcotest-lwt))
(rule (rule
(alias runtest) (alias runtest)

View file

@ -17,12 +17,10 @@ let () = Logs.set_level ~all:true (Some Logs.Debug)
(* Functoria *) (* Functoria *)
module Happy_eyeballs = module Happy_eyeballs =
Happy_eyeballs_mirage.Make (Time) (Mclock) (Tcpip_stack_socket.V4V6) Happy_eyeballs_mirage.Make (Tcpip_stack_socket.V4V6)
module DNS_client = module DNS_client =
Dns_client_mirage.Make (Mirage_crypto_rng) (Time) (Mclock) (Pclock) Dns_client_mirage.Make (Tcpip_stack_socket.V4V6) (Happy_eyeballs)
(Tcpip_stack_socket.V4V6)
(Happy_eyeballs)
module Mimic_happy_eyeballs = module Mimic_happy_eyeballs =
Mimic_happy_eyeballs.Make (Tcpip_stack_socket.V4V6) (Happy_eyeballs) Mimic_happy_eyeballs.Make (Tcpip_stack_socket.V4V6) (Happy_eyeballs)
@ -31,8 +29,7 @@ module Mimic_happy_eyeballs =
module HTTP_server = Paf_mirage.Make (Tcpip_stack_socket.V4V6.TCP) module HTTP_server = Paf_mirage.Make (Tcpip_stack_socket.V4V6.TCP)
module HTTP_client = module HTTP_client =
Http_mirage_client.Make (Pclock) (Tcpip_stack_socket.V4V6.TCP) Http_mirage_client.Make (Tcpip_stack_socket.V4V6.TCP) (Mimic_happy_eyeballs)
(Mimic_happy_eyeballs)
let http_1_1_error_handler ?notify (ipaddr, port) ?request:_ error respond = let http_1_1_error_handler ?notify (ipaddr, port) ?request:_ error respond =
let contents = let contents =