diff --git a/conduit-lwt-unix.opam b/conduit-lwt-unix.opam index d60cca77..5f177fa0 100644 --- a/conduit-lwt-unix.opam +++ b/conduit-lwt-unix.opam @@ -25,7 +25,7 @@ depends: [ ] depopts: ["tls" "lwt_ssl" "launchd"] conflicts: [ - "tls" {< "0.11.0"} + "tls" {< "0.13.0"} "ssl" {< "0.5.9"} ] build: [ @@ -34,3 +34,7 @@ build: [ ] dev-repo: "git+https://github.com/mirage/ocaml-conduit.git" synopsis: "A network connection establishment library for Lwt_unix" +pin-depends: [ + [ "tls.0.13.0" "git+https://github.com/mirleft/ocaml-tls.git#f9dd61f556d3f2790aa9eedcf2b6b3c8c99cb338" ] + [ "tls-mirage.0.13.0" "git+https://github.com/mirleft/ocaml-tls.git#f9dd61f556d3f2790aa9eedcf2b6b3c8c99cb338" ] +] diff --git a/conduit-mirage.opam b/conduit-mirage.opam index da598a9a..3200a57d 100644 --- a/conduit-mirage.opam +++ b/conduit-mirage.opam @@ -12,13 +12,13 @@ depends: [ "sexplib" "uri" {>= "4.0.0"} "cstruct" {>= "3.0.0"} - "mirage-stack" {>= "2.0.0"} + "mirage-stack" {>= "2.2.0"} "mirage-clock" {>= "3.0.0"} "mirage-flow" {>= "2.0.0"} "mirage-flow-combinators" {>= "2.0.0"} "mirage-random" {>= "2.0.0"} "mirage-time" {>= "2.0.0"} - "dns-client" {>= "4.5.0"} + "dns-client" {>= "5.0.0"} "conduit-lwt" {=version} "vchan" {>= "5.0.0"} "xenstore" @@ -38,5 +38,12 @@ build: [ ["dune" "build" "-p" name "-j" jobs] ["dune" "runtest" "-p" name] {with-test} ] +pin-depends: [ + [ "dns-client.5.0.0" "git+https://github.com/mirage/ocaml-dns.git#29168a8c464796fda77b50d721176f122ee724ae" ] + [ "dns.5.0.0" "git+https://github.com/mirage/ocaml-dns.git#29168a8c464796fda77b50d721176f122ee724ae" ] + [ "x509.0.12.0" "git+https://github.com/mirleft/ocaml-x509.git#02f662eaf7a549ff071a939b86a2e0bfaabc5890" ] + [ "tls.0.13.0" "git+https://github.com/mirleft/ocaml-tls.git#f9dd61f556d3f2790aa9eedcf2b6b3c8c99cb338" ] + [ "tls-mirage.0.13.0" "git+https://github.com/mirleft/ocaml-tls.git#f9dd61f556d3f2790aa9eedcf2b6b3c8c99cb338" ] +] dev-repo: "git+https://github.com/mirage/ocaml-conduit.git" synopsis: "A network connection establishment library for MirageOS" diff --git a/src/conduit-lwt-unix/conduit_lwt_tls.real.mli b/src/conduit-lwt-unix/conduit_lwt_tls.real.mli index e29cc8b2..099ff520 100644 --- a/src/conduit-lwt-unix/conduit_lwt_tls.real.mli +++ b/src/conduit-lwt-unix/conduit_lwt_tls.real.mli @@ -18,7 +18,7 @@ (** TLS/SSL connections via OCaml-TLS *) module X509 : sig - val private_of_pems : cert:string -> priv_key:string -> X509_lwt.priv Lwt.t + val private_of_pems : cert:string -> priv_key:string -> Tls.Config.certchain Lwt.t type authenticator = X509.Authenticator.t diff --git a/src/conduit-mirage/conduit_mirage.ml b/src/conduit-mirage/conduit_mirage.ml index c8bea2c2..1390c07e 100644 --- a/src/conduit-mirage/conduit_mirage.ml +++ b/src/conduit-mirage/conduit_mirage.ml @@ -29,7 +29,6 @@ let err_domain_sockets_not_supported = let err_vchan_not_supported = fail "%s: VCHAN is not supported" let err_unknown = fail "%s: unknown endpoint type" -let err_ipv6 = fail "%s: IPv6 is not supported" let err_not_supported = function | `TLS _ -> err_tls_not_supported @@ -64,32 +63,29 @@ end let tcp_client i p = Lwt.return (`TCP (i, p)) let tcp_server _ p = Lwt.return (`TCP p) -module TCP (S : Mirage_stack.V4) = struct - module Flow = S.TCPV4 +module TCP (S : Mirage_stack.V4V6) = struct + module Flow = S.TCP type flow = Flow.flow type t = S.t let err_tcp e = Lwt.fail - @@ Failure (Format.asprintf "TCP connection failed: %a" S.TCPV4.pp_error e) + @@ Failure (Format.asprintf "TCP connection failed: %a" S.TCP.pp_error e) let connect (t : t) (c : client) = match c with | `TCP (ip, port) -> ( - match Ipaddr.to_v4 ip with - | None -> err_ipv6 "connect" - | Some ip -> ( - S.TCPV4.create_connection (S.tcpv4 t) (ip, port) >>= function - | Error e -> err_tcp e - | Ok flow -> Lwt.return flow)) + S.TCP.create_connection (S.tcp t) (ip, port) >>= function + | Error e -> err_tcp e + | Ok flow -> Lwt.return flow) | _ -> err_not_supported c "connect" let listen (t : t) (s : server) fn = match s with | `TCP port -> let s, _u = Lwt.task () in - S.listen_tcpv4 t ~port (fun flow -> fn flow); + S.listen_tcp t ~port (fun flow -> fn flow); s | _ -> err_not_supported s "listen" end diff --git a/src/conduit-mirage/conduit_mirage.mli b/src/conduit-mirage/conduit_mirage.mli index 70852894..23585986 100644 --- a/src/conduit-mirage/conduit_mirage.mli +++ b/src/conduit-mirage/conduit_mirage.mli @@ -83,8 +83,8 @@ end (** {2 TCP} *) -module TCP (S : Mirage_stack.V4) : - S with type t = S.t and type flow = S.TCPV4.flow +module TCP (S : Mirage_stack.V4V6) : + S with type t = S.t and type flow = S.TCP.flow (** {2 VCHAN} *) diff --git a/src/conduit-mirage/resolver_mirage.ml b/src/conduit-mirage/resolver_mirage.ml index 4a842fba..400a29e9 100644 --- a/src/conduit-mirage/resolver_mirage.ml +++ b/src/conduit-mirage/resolver_mirage.ml @@ -28,7 +28,7 @@ module Make (R : Mirage_random.S) (T : Mirage_time.S) (C : Mirage_clock.MCLOCK) - (S : Mirage_stack.V4) = + (S : Mirage_stack.V4V6) = struct include Resolver_lwt diff --git a/src/conduit-mirage/resolver_mirage.mli b/src/conduit-mirage/resolver_mirage.mli index 80e8d6d6..b309ae78 100644 --- a/src/conduit-mirage/resolver_mirage.mli +++ b/src/conduit-mirage/resolver_mirage.mli @@ -34,9 +34,9 @@ module Make (R : Mirage_random.S) (T : Mirage_time.S) (C : Mirage_clock.MCLOCK) - (S : Mirage_stack.V4) : sig + (S : Mirage_stack.V4V6) : sig include S - val v : ?ns:Ipaddr.V4.t -> ?ns_port:int -> S.t -> t + val v : ?ns:Ipaddr.t -> ?ns_port:int -> S.t -> t (** [v ?ns ?ns_port ?stack ()] TODO *) end diff --git a/tests/conduit-mirage/simple/test.ml b/tests/conduit-mirage/simple/test.ml index 28a22747..fd4d2e2e 100644 --- a/tests/conduit-mirage/simple/test.ml +++ b/tests/conduit-mirage/simple/test.ml @@ -5,12 +5,14 @@ let client : Conduit_mirage.client = let server : Conduit_mirage.server = `TCP 12345 -module TCP = Conduit_mirage.TCP (Tcpip_stack_socket.V4) +module TCP = Conduit_mirage.TCP (Tcpip_stack_socket.V4V6) let tcp () = - Udpv4_socket.connect Ipaddr.V4.Prefix.global >>= fun udp -> - Tcpv4_socket.connect Ipaddr.V4.Prefix.global >>= fun tcp -> - Tcpip_stack_socket.V4.connect udp tcp + let ipv4_only = false and ipv6_only = false in + Udpv4v6_socket.connect ~ipv4_only ~ipv6_only Ipaddr.V4.Prefix.global None + >>= fun udp -> + Tcpv4v6_socket.connect ~ipv4_only ~ipv6_only Ipaddr.V4.Prefix.global None + >>= fun tcp -> Tcpip_stack_socket.V4V6.connect udp tcp let _client () = tcp () >>= fun t -> TCP.connect t client