diff --git a/include/quicer_types.hrl b/include/quicer_types.hrl index 51033269..bcdfba76 100644 --- a/include/quicer_types.hrl +++ b/include/quicer_types.hrl @@ -86,9 +86,9 @@ , key := file:filename() , keyfile := file:filename() , verify => none | peer | verify_peer | verify_none - , cacertfile => filelib:filename() + , cacertfile => file:filename() , password => string() - , sslkeylogfile => filelib:filename() + , sslkeylogfile => file:filename() , allow_insecure => boolean() , quic_registration => reg_handle() , conn_acceptors => non_neg_integer() @@ -141,16 +141,16 @@ -type conn_opts() :: quic_settings() | #{ alpn := [string()] , conn_callback => module() - , cert => filelib:filename() - , certfile => filelib:filename() - , key => filelib:filename() - , keyfile => filelib:filename() + , cert => file:filename() + , certfile => file:filename() + , key => file:filename() + , keyfile => file:filename() , password => string() , verify => none | peer , handle => connection_handle() %% get NST from last connection, for reconnect. , nst => binary() - , cacertfile => filelib:filename() - , sslkeylogfile => filelib:filename() + , cacertfile => file:filename() + , sslkeylogfile => file:filename() , peer_bidi_stream_count => uint16() , peer_unidi_stream_count => uint16() , handshake_idle_timeout_ms => non_neg_integer() diff --git a/rebar.config b/rebar.config index 7410bb70..b095f855 100644 --- a/rebar.config +++ b/rebar.config @@ -66,7 +66,7 @@ ]}. {dialyzer, [ - {warnings, [unmatched_returns, error_handling, no_unknown]}, + {warnings, [unmatched_returns, error_handling]}, {plt_apps, all_apps}, {statistics, true} ] diff --git a/src/quicer.erl b/src/quicer.erl index 6809d010..662eb876 100644 --- a/src/quicer.erl +++ b/src/quicer.erl @@ -129,8 +129,20 @@ %% versions -export([abi_version/0]). --type connection_opts() :: proplists:proplist() | quicer_connection:opts(). --type listener_opts() :: proplists:proplist() | quicer_listener:listener_opts(). + +%% export types +-export_type([listener_handle/0, + listener_opts/0, + connection_handle/0, + conn_opts/0, + stream_handle/0, + stream_opts/0 + ]). + + + +-type connection_opts() :: proplists:proplist() | conn_opts(). +-type listener_opts() :: proplists:proplist() | listen_opts(). %% @doc Return ABI version of the library. -spec abi_version() -> quicer_nif:abi_version(). @@ -288,7 +300,7 @@ listen(ListenOn, Opts) when is_map(Opts) -> close_listener(Listener) -> close_listener(Listener, 5000). --spec close_listener(listener_handle(), timer:time()) -> +-spec close_listener(listener_handle(), timeout()) -> ok | {error, badarg | closed | timeout}. close_listener(Listener, Timeout) -> case quicer_nif:close_listener(Listener) of diff --git a/src/quicer_connection.erl b/src/quicer_connection.erl index b8b33c73..edd683c6 100644 --- a/src/quicer_connection.erl +++ b/src/quicer_connection.erl @@ -157,7 +157,7 @@ start_link(CallbackModule, {_Host, _Port} = Peer, {_COpts, _SOpts} = Opts) when %% Get `CallbackModule` from conn_opts, key:`conn_callback` if `CallbackModule` is undefined, %% this is the entry for supervised acceptor. -spec start_link(CallbackModule :: undefined | module(), - Listener ::quicer:listener_handle(), + Listener :: quicer:listener_handle(), ConnOpts :: term(), Sup :: pid()) -> {ok, Pid :: pid()} | {error, Error :: {already_started, pid()}} | diff --git a/src/quicer_lib.erl b/src/quicer_lib.erl index 3fe6f71c..c517e643 100644 --- a/src/quicer_lib.erl +++ b/src/quicer_lib.erl @@ -17,6 +17,7 @@ -include("quicer_types.hrl"). -export_type([ cb_ret/0 + , cb_state/0 ]). -type cb_ret() :: cb_ret_noreply() | cb_ret_reply(). -type cb_state() :: term(). diff --git a/src/quicer_listener.erl b/src/quicer_listener.erl index 4ddf56b4..3b299ad2 100644 --- a/src/quicer_listener.erl +++ b/src/quicer_listener.erl @@ -49,9 +49,9 @@ -spec start_link(Name :: listener_name(), ListenOn :: listen_on(), Options :: - { listener_opts() - , quicer_connection:opts() - , quicer_stream:stream_opts() + { quicer:listener_opts() + , quicer:conn_opts() + , quicer:stream_opts() } ) -> {ok, Pid :: pid()} | {error, Error :: {already_started, pid()}} | diff --git a/src/quicer_nif.erl b/src/quicer_nif.erl index 4652e01a..fbd315e0 100644 --- a/src/quicer_nif.erl +++ b/src/quicer_nif.erl @@ -306,7 +306,7 @@ controlling_process(_H, _P) -> erlang:nif_error(nif_library_not_loaded). -spec peercert(connection_handle() | stream_handle()) -> - {ok, Cert:: public_key:der_encoded()} | {error, any()}. + {ok, Cert :: public_key:der_encoded()} | {error, any()}. peercert(_Handle) -> erlang:nif_error(nif_library_not_loaded). diff --git a/src/quicer_stream.erl b/src/quicer_stream.erl index a54e4ca9..b629211e 100644 --- a/src/quicer_stream.erl +++ b/src/quicer_stream.erl @@ -104,8 +104,8 @@ -define(post_init, post_init). --type state() :: #{ stream := quicer:stream_handle() - , conn := quicer:connection_handle() +-type state() :: #{ stream := stream_handle() + , conn := connection_handle() , callback := atom() , callback_state := term() , is_owner := boolean() @@ -123,7 +123,7 @@ %%-------------------------------------------------------------------- %% Start acceptor or Start new local stream -spec start_link(Callback :: module(), - Conn :: quicer:connection_handle(), + Conn :: connection_handle(), StreamOpts :: map()) -> {ok, Pid :: pid()} | {error, Error :: {already_started, pid()}} | {error, Error :: term()} | @@ -136,8 +136,8 @@ start_link(Callback, Conn, StreamOpts) when is_atom(Callback) -> %% then handoff ownership to this process %%-------------------------------------------------------------------- -spec start_link(Callback :: module(), - Stream :: quicer:connection_handle(), - Conn :: quicer:connection_handle(), + Stream :: connection_handle(), + Conn :: connection_handle(), StreamOpts :: map(), Props :: new_stream_props() ) -> {ok, Pid :: pid()} |