View Source partisan_peer_socket (partisan v5.0.0-rc.8)
Wrapper that allows transparent usage of plain TCP or TLS socket for peer connections.
This module also implements the monotonic channel functionality.Summary
Functions
Wraps a TCP socket with the appropriate information for transceiving on and controlling the socket later. If TLS/SSL is enabled, this performs the socket upgrade/negotiation before returning the wrapped socket.
See also: gen_tcp:close/1, ssl:close/1.
See also: gen_tcp:recv/2, ssl:recv/2.
See also: gen_tcp:send/2, ssl:send/2.
Returns the wrapped socket from within the connection.
Types
-type options() :: [gen_tcp:option()] | map().
-type reason() :: closed | inet:posix().
-type t() :: #partisan_peer_socket{}.
Functions
-spec accept(gen_tcp:socket()) -> t().
-spec close(t()) -> ok.
See also: gen_tcp:close/1, ssl:close/1.
-spec connect(inet:socket_address() | inet:hostname(), inet:port_number(), options()) -> {ok, t()} | {error, inet:posix()}.
See also: gen_tcp:connect/3, ssl:connect/3.
-spec connect(inet:socket_address() | inet:hostname(), inet:port_number(), options(), timeout()) -> {ok, t()} | {error, inet:posix()}.
-spec connect(inet:socket_address() | inet:hostname(), inet:port_number(), options(), timeout(), map() | list()) -> {ok, t()} | {error, inet:posix()}.
See also: gen_tcp:recv/2, ssl:recv/2.
See also: gen_tcp:recv/3, ssl:recv/3.
See also: gen_tcp:send/2, ssl:send/2.
-spec setopts(t(), options()) -> ok | {error, inet:posix()}.
See also: inet:setopts/2, ssl:setopts/2.
-spec socket(t()) -> gen_tcp:socket() | ssl:sslsocket().