View Source esockd_transport (esockd v5.9.3-rc.1)

Link to this section Summary

Link to this section Types

Link to this type

pp2_additional_field/0

View Source
-type pp2_additional_field() ::
    {pp2_alpn, binary()} |
    {pp2_authority, binary()} |
    {pp2_crc32c, integer()} |
    {pp2_netns, binary()} |
    {pp2_ssl, [pp2_additional_ssl_field()]}.
Link to this type

pp2_additional_ssl_field/0

View Source
-type pp2_additional_ssl_field() ::
    {pp2_ssl_client, boolean()} |
    {pp2_ssl_client_cert_conn, boolean()} |
    {pp2_ssl_client_cert_sess, boolean()} |
    {pp2_ssl_verify, success | failed} |
    {pp2_ssl_version, binary()} |
    {pp2_ssl_cn, binary()} |
    {pp2_ssl_cipher, binary()} |
    {pp2_ssl_sig_alg, binary()} |
    {pp2_ssl_key_alg, binary()}.
-type proxy_socket() :: #proxy_socket{}.
-type socket() :: inet:socket() | ssl_socket() | proxy_socket() | #sslsocket{}.
-type ssl_socket() :: #ssl_socket{}.

Link to this section Functions

Link to this function

async_recv(Sock, Length)

View Source
-spec async_recv(socket(), non_neg_integer()) -> {ok, reference()}.
Async receive data.
Link to this function

async_recv(Sock, Length, Timeout)

View Source
-spec async_recv(socket(), non_neg_integer(), timeout()) -> {ok, reference()}.
-spec async_send(socket(), iodata()) -> ok | {error, Reason}
              when Reason :: close | timeout | inet:posix().
Port command to write data.
Link to this function

async_send(Sock, Data, Options)

View Source
-spec async_send(socket(), iodata(), [force | nosuspend]) -> ok | {error, Reason}
              when Reason :: close | timeout | inet:posix().
-spec close(socket()) -> ok | {error, term()}.
Link to this function

controlling_process(Sock, NewOwner)

View Source
-spec controlling_process(socket(), pid()) -> ok | {error, Reason}
                       when Reason :: closed | not_owner | badarg | inet:posix().
Link to this function

ensure_ok_or_exit(Fun, Args)

View Source
-spec ensure_ok_or_exit(atom(), [term()]) -> term().
-spec fast_close(socket()) -> ok.
Link to this function

getopts(Sock, OptionNames)

View Source
-spec getopts(socket(), [inet:socket_getopt()]) -> {ok, [inet:socket_setopt()]} | {error, inet:posix()}.
Get socket options.
-spec getstat(socket(), [inet:stat_option()]) ->
           {ok, [{inet:stat_option(), integer()}]} | {error, inet:posix()}.
Get socket stats
-spec is_ssl(socket()) -> boolean().
-spec listen(inet:port_number(), [gen_tcp:listen_option()]) ->
          {ok, inet:socket()} | {error, system_limit | inet:posix()}.
Link to this function

peer_cert_common_name(Sock)

View Source
-spec peer_cert_common_name(socket()) -> undefined | binary().
Peercert common name
-spec peer_cert_subject(socket()) -> undefined | binary().
Peercert subject
-spec peercert(socket()) -> nossl | binary() | [pp2_additional_ssl_field()] | {error, term()}.
Socket peercert
-spec peername(socket()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, inet:posix()}.
Peername
Link to this function

proxy_upgrade(Sock, Timeout)

View Source
TCP | SSL -> ProxySocket
Link to this function

ready(Pid, Sock, UpgradeFuns)

View Source
-spec ready(pid(), socket(), [esockd:sock_fun()]) -> any().
-spec recv(socket(), non_neg_integer()) -> {ok, iodata()} | {error, closed | inet:posix()}.
Link to this function

recv(Sock, Length, Timeout)

View Source
-spec recv(socket(), non_neg_integer(), timeout()) -> {ok, iodata()} | {error, closed | inet:posix()}.
-spec send(socket(), iodata()) -> ok | {error, Reason} when Reason :: closed | timeout | inet:posix().
-spec setopts(socket(), [inet:socket_setopt()]) -> ok | {error, inet:posix()}.
Set socket options
-spec shutdown(socket(), How) -> ok | {error, inet:posix()} when How :: read | write | read_write.
Shutdown socket
-spec sockname(socket()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, inet:posix()}.
Sockname
Link to this function

ssl_upgrade(Sock, SslOpts1, _)

View Source
Link to this function

ssl_upgrade_fun(SslOpts)

View Source
-spec ssl_upgrade_fun([ssl:ssl_option()]) -> esockd:sock_fun().
TCP/DTLS socket -> #ssl_socket{}
-spec type(socket()) -> tcp | ssl | proxy.
-spec wait(socket()) -> {ok, socket()} | {error, term()}.