hackney_ssl (hackney v4.0.1)
View SourceSummary
Functions
Generate ALPN options for SSL connection. Returns a list containing alpn_advertised_protocols option based on the protocols specified in Options.
Close a TCP socket.
Assign a new controlling process Pid to Socket.
Get the negotiated protocol after SSL handshake. Returns http2 if HTTP/2 was negotiated, http1 otherwise. Note: HTTP/3 is not returned here as it uses QUIC, not TLS.
Atoms used to identify messages in {active, once | true} mode.
Return the peer certificate of an SSL connection.
Return the address and port for the other end of a connection.
Receive a packet from a socket in passive mode.
Send a packet on a socket.
Set one or more options for a socket.
Immediately close a socket in one or two directions.
Get the local address and port of a socket
Build SSL options for a connection. Used by proxy modules for SSL upgrade after tunnel establishment.
Functions
Generate ALPN options for SSL connection. Returns a list containing alpn_advertised_protocols option based on the protocols specified in Options.
Options: - protocols: list of atoms [http3, http2, http1] (default: [http2, http1]) Order matters - first protocol is preferred Note: http3 is only used for informational purposes here - HTTP/3 uses QUIC which has its own ALPN negotiation handled by hackney_http3.
Example:
alpn_opts([{protocols, [http2, http1]}]) ->
[{alpn_advertised_protocols, [<<"h2">>, <<"http/1.1">>]}]
-spec close(ssl:sslsocket()) -> ok.
Close a TCP socket.
See also: ssl:close/1.
-spec controlling_process(ssl:sslsocket(), pid()) -> ok | {error, closed | not_owner | atom()}.
Assign a new controlling process Pid to Socket.
See also: ssl:controlling_process/2.
-spec get_negotiated_protocol(ssl:sslsocket()) -> http2 | http1.
Get the negotiated protocol after SSL handshake. Returns http2 if HTTP/2 was negotiated, http1 otherwise. Note: HTTP/3 is not returned here as it uses QUIC, not TLS.
See also: ssl:negotiated_protocol/1.
Atoms used to identify messages in {active, once | true} mode.
-spec peercert(ssl:sslsocket()) -> {ok, binary()} | {error, atom()}.
Return the peer certificate of an SSL connection.
See also: ssl:peercert/1.
-spec peername(ssl:sslsocket()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}.
Return the address and port for the other end of a connection.
See also: ssl:peername/1.
-spec recv(ssl:sslsocket(), non_neg_integer(), timeout()) -> {ok, any()} | {error, closed | atom()}.
Receive a packet from a socket in passive mode.
See also: ssl:recv/3.
-spec send(ssl:sslsocket(), iolist()) -> ok | {error, atom()}.
Send a packet on a socket.
See also: ssl:send/2.
-spec setopts(ssl:sslsocket(), list()) -> ok | {error, atom()}.
Set one or more options for a socket.
See also: ssl:setopts/2.
-spec shutdown(ssl:sslsocket(), read | write | read_write) -> ok | {error, any()}.
Immediately close a socket in one or two directions.
See also: ssl:shutdown/2.
-spec sockname(ssl:sslsocket()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}.
Get the local address and port of a socket
See also: ssl:sockname/1.
Build SSL options for a connection. Used by proxy modules for SSL upgrade after tunnel establishment.