Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions lwt-unix/h2_lwt_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,43 @@ module Server = struct
module TLS = struct
include H2_lwt.Server (Gluten_lwt_unix.Server.TLS)

let create_connection_handler_full
~certificates
?config
~request_handler
~error_handler
?ciphers
?version
?signature_algorithms
?reneg
?acceptable_cas
?authenticator
?zero_rtt
?ip
=
let make_tls_server =
Gluten_lwt_unix.Server.TLS.create_full
?ciphers
?version
?signature_algorithms
?reneg
~certificates:certificates
?acceptable_cas
?authenticator
~alpn_protocols:[ "h2" ]
?zero_rtt
?ip
in
fun client_addr socket ->
make_tls_server client_addr socket >>= fun tls_server ->
create_connection_handler
?config
~request_handler
~error_handler
client_addr
tls_server


let create_connection_handler_with_default
~certfile
~keyfile
Expand Down Expand Up @@ -95,6 +132,26 @@ module Client = struct
module TLS = struct
include H2_lwt.Client (Gluten_lwt_unix.Client.TLS)

let create_connection_full
?config
?push_handler
~error_handler
?certificates
?peer_name
?ciphers
?version
?signature_algorithms
?reneg
~authenticator
?ip
socket
=
Gluten_lwt_unix.Client.TLS.create_full authenticator ?peer_name ?ciphers ?version
?signature_algorithms ?reneg ?certificates
~alpn_protocols:[ "h2" ] ?ip socket
>>= fun tls_client ->
create_connection ?config ?push_handler ~error_handler tls_client

let create_connection_with_default
?config
?push_handler
Expand Down
33 changes: 33 additions & 0 deletions lwt-unix/h2_lwt_unix.mli
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ module Server : sig
with type socket = Gluten_lwt_unix.Server.TLS.socket
and type addr := Unix.sockaddr

val create_connection_handler_full
: certificates:Tls.Config.own_cert
-> ?config:Config.t
-> request_handler:(Unix.sockaddr -> Server_connection.request_handler)
-> error_handler:(Unix.sockaddr -> Server_connection.error_handler)
-> ?ciphers:Tls.Ciphersuite.ciphersuite list
-> ?version:(Tls.Core.tls_version * Tls.Core.tls_version)
-> ?signature_algorithms:Tls.Core.signature_algorithm list
-> ?reneg:bool
-> ?acceptable_cas:X509.Distinguished_name.t list
-> ?authenticator:X509.Authenticator.t
-> ?zero_rtt:int32
-> ?ip:Ipaddr.t
-> Unix.sockaddr
-> Lwt_unix.file_descr
-> unit Lwt.t

val create_connection_handler_with_default
: certfile:string
-> keyfile:string
Expand Down Expand Up @@ -87,6 +104,22 @@ module Client : sig
with type socket = Gluten_lwt_unix.Client.TLS.socket
and type runtime = Gluten_lwt_unix.Client.TLS.t

val create_connection_full
: ?config:Config.t
-> ?push_handler:
(Request.t -> (Client_connection.response_handler, unit) result)
-> error_handler:Client_connection.error_handler
-> ?certificates:Tls.Config.own_cert
-> ?peer_name:[ `host ] Domain_name.t
-> ?ciphers:Tls.Ciphersuite.ciphersuite list
-> ?version:(Tls.Core.tls_version * Tls.Core.tls_version)
-> ?signature_algorithms:Tls.Core.signature_algorithm list
-> ?reneg:bool
-> authenticator:X509.Authenticator.t
-> ?ip:Ipaddr.t
-> Lwt_unix.file_descr
-> t Lwt.t

val create_connection_with_default
: ?config:Config.t
-> ?push_handler:
Expand Down