Files
linuxkit/projects/miragesdk/examples/https-unikernel/src/tls_main.ml
Thomas Leonard c7c33b9a56 Add example https-unikernel
This is mainly a test for the Cap'n'Proto RPC support.

Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
2017-06-07 16:34:59 +01:00

24 lines
627 B
OCaml

let () = Common.init_logging ()
let main http_socket port =
Lwt_main.run begin
Lwt_switch.with_switch @@ fun switch ->
let http_service = Common.connect ~switch http_socket in
Tls_terminator.run ~http_service ~port
end
open Cmdliner
let http =
let doc = "The HTTP service to use" in
Arg.(required @@ opt (some string) None @@ info ~doc ~docv:"HTTP" ["http"])
let tls =
let doc = "The TLS port on which to listen for incoming connections" in
Arg.(value @@ opt int 8443 @@ info ~doc ~docv:"PORT" ["port"])
let cmd =
Term.(const main $ http $ tls), Term.info "tls"
let () = Term.(exit @@ eval cmd)