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

Link to this section Summary

Functions

Allow access address
Create a Child spec for a TCP/SSL Listener. It is a convenient method for creating a Child spec to hang on another Application supervisor.
Close the listener
just close port, don't kill esockd supervisor process made connection close
Deny access address
Create a Child spec for a DTLS Listener.
Parse Address
Get acceptors number
Get access rules
Get current connections
Set max connection rate
Get max connections
Get options
Get shutdown count
Get stats
Get one listener.
Get listeners.
Merge two options
Open a TCP or SSL listener
Open a UDP listener
Parse option.
Reopen the listener
resume port when use close port
Set max connection rate
Set max connections
Start esockd application.
Create a Child spec for a UDP Listener.
System 'ulimit -n'

Link to this section Types

-type conn_limit() :: map() | {pos_integer(), pos_integer()}.
-type dtls_options() :: [{handshake_timeout, pos_integer()} | ssl:ssl_option()].
-type host() :: inet:ip_address() | string().
-type listen_on() :: inet:port_number() | {host(), inet:port_number()}.
-type mfargs() :: atom() | {atom(), atom()} | {module(), atom(), [term()]}.
-type option() ::
    {acceptors, pos_integer()} |
    {max_connections, pos_integer()} |
    {max_conn_rate, conn_limit()} |
    {access_rules, [esockd_access:rule()]} |
    {shutdown, brutal_kill | infinity | pos_integer()} |
    tune_buffer |
    {tune_buffer, boolean()} |
    proxy_protocol |
    {proxy_protocol, boolean()} |
    {proxy_protocol_timeout, timeout()} |
    {ssl_options, ssl_options()} |
    {tcp_options, [gen_tcp:listen_option()]} |
    {udp_options, [gen_udp:option()]} |
    {dtls_options, dtls_options()}.
-type options() :: [option()].
-type proto() :: atom().
-type sock_fun() :: {function(), list()}.
-type socket() :: esockd_transport:socket().
-type ssl_options() :: [{handshake_timeout, pos_integer()} | ssl:ssl_option()].
-type transport() :: module().
-type udp_transport() :: {udp | dtls, pid(), inet:socket()}.

Link to this section Functions

-spec allow({atom(), listen_on()}, all | esockd_cidr:cidr_string()) -> ok.
Allow access address
Link to this function

child_spec(Proto, ListenOn, Opts, MFA)

View Source
-spec child_spec(atom(), listen_on(), [option()], mfargs()) -> supervisor:child_spec().
Create a Child spec for a TCP/SSL Listener. It is a convenient method for creating a Child spec to hang on another Application supervisor.
-spec close({atom(), listen_on()}) -> ok | {error, term()}.
Close the listener
-spec close(atom(), listen_on()) -> ok | {error, term()}.
-spec close_port({atom(), listen_on()}) -> ok | {error, term()}.
just close port, don't kill esockd supervisor process made connection close
Link to this function

close_port(Proto, ListenOn)

View Source
-spec close_port(atom(), listen_on()) -> ok | {error, term()}.
-spec deny({atom(), listen_on()}, all | esockd_cidr:cidr_string()) -> ok.
Deny access address
Link to this function

dtls_child_spec(Proto, ListenOn, Opts, MFA)

View Source
-spec dtls_child_spec(atom(), listen_on(), options(), mfargs()) -> supervisor:child_spec().
Create a Child spec for a DTLS Listener.
Parse Address
-spec format({inet:ip_address(), inet:port_number()}) -> string().
-spec get_acceptors({atom(), listen_on()}) -> pos_integer().
Get acceptors number
-spec get_access_rules({atom(), listen_on()}) -> [esockd_access:rule()].
Get access rules
Link to this function

get_current_connections(_)

View Source
-spec get_current_connections({atom(), listen_on()}) -> non_neg_integer().
Get current connections
-spec get_max_conn_rate({atom(), listen_on()}) -> conn_limit().
Set max connection rate
-spec get_max_connections({atom(), listen_on()} | pid()) -> pos_integer().
Get max connections
-spec get_options({atom(), listen_on()}) -> options().
Get options
-spec get_shutdown_count({atom(), listen_on()}) -> pos_integer().
Get shutdown count
-spec get_stats({atom(), listen_on()}) -> [{atom(), non_neg_integer()}].
Get stats
-spec listener({atom(), listen_on()}) -> pid().
Get one listener.
-spec listeners() -> [{{atom(), listen_on()}, pid()}].
Get listeners.
Link to this function

merge_opts(Defaults, Options)

View Source
Merge two options
Link to this function

open(Proto, Port, Opts, MFA)

View Source
-spec open(atom(), listen_on(), [option()], mfargs()) -> {ok, pid()} | {error, term()}.
Open a TCP or SSL listener
Link to this function

open_dtls(Proto, ListenOn, Opts, MFA)

View Source
-spec open_dtls(atom(), listen_on(), options(), mfargs()) -> {ok, pid()} | {error, term()}.
Open a DTLS listener
Link to this function

open_udp(Proto, Port, Opts, MFA)

View Source
-spec open_udp(atom(), listen_on(), [option()], mfargs()) -> {ok, pid()} | {error, term()}.
Open a UDP listener
Parse option.
-spec reopen({atom(), listen_on()}) -> {ok, pid()} | {error, term()}.
Reopen the listener
-spec reopen(atom(), listen_on()) -> {ok, pid()} | {error, term()}.
-spec resume_port({atom(), listen_on()}) -> ok | {error, term()}.
resume port when use close port
Link to this function

resume_port(Proto, ListenOn)

View Source
-spec resume_port(atom(), listen_on()) -> ok | {error, term()}.
Link to this function

set_max_conn_rate(_, Opt)

View Source
-spec set_max_conn_rate({atom(), listen_on()}, conn_limit()) -> ok.
Set max connection rate
Link to this function

set_max_connections(_, MaxConns)

View Source
-spec set_max_connections({atom(), listen_on()}, pos_integer()) -> ok.
Set max connections
-spec start() -> ok.
Start esockd application.
-spec to_string(listen_on()) -> string().
Link to this function

udp_child_spec(Proto, Port, Opts, MFA)

View Source
-spec udp_child_spec(atom(), listen_on(), options(), mfargs()) -> supervisor:child_spec().
Create a Child spec for a UDP Listener.
-spec ulimit() -> pos_integer().
System 'ulimit -n'