This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
open Ex_common
|
||||
open Lwt
|
||||
|
||||
let echo_client host port =
|
||||
let open Lwt_io in
|
||||
let port = int_of_string port in
|
||||
let authenticator = null_auth in
|
||||
Tls_lwt.Unix.connect
|
||||
(get_ok Tls.Config.(client ~authenticator ~alpn_protocols:["http/1.1"; "h2"] ()))
|
||||
(host, port) >>= fun t ->
|
||||
match Tls_lwt.Unix.epoch t with
|
||||
| Error () -> printl "Error"
|
||||
| Ok epoch -> (
|
||||
match epoch.Tls.Core.alpn_protocol with
|
||||
| None -> printl "No protocol selected"
|
||||
| Some protocol -> printl ("Selected protocol: " ^ protocol)
|
||||
)
|
||||
>>= fun () -> Tls_lwt.Unix.close t
|
||||
|
||||
let () =
|
||||
Lwt_main.run (echo_client "127.0.0.1" "4433")
|
||||
Loading…
Add table
Add a link
Reference in a new issue