Use the new function ranch_proxy_header:to_connection_info/1
This commit is contained in:
parent
d327e8a7cb
commit
0a2bde4ab1
|
|
@ -100,26 +100,12 @@ ssl_info(_Sock) ->
|
||||||
nossl.
|
nossl.
|
||||||
|
|
||||||
proxy_ssl_info(Sock, {rabbit_proxy_socket, _, ProxyInfo}) ->
|
proxy_ssl_info(Sock, {rabbit_proxy_socket, _, ProxyInfo}) ->
|
||||||
case ProxyInfo of
|
ConnInfo = ranch_proxy_header:to_connection_info(ProxyInfo),
|
||||||
#{ssl := #{version := Version, cipher := Cipher}} ->
|
case lists:keymember(protocol, 1, ConnInfo) andalso
|
||||||
Proto = case Version of
|
lists:keymember(selected_cipher_suite, 1, ConnInfo) of
|
||||||
<<"SSL3">> -> 'ssl3';
|
true ->
|
||||||
<<"TLSv1">> -> 'tlsv1';
|
{ok, ConnInfo};
|
||||||
<<"TLSv1.1">> -> 'tlsv1.1';
|
false ->
|
||||||
<<"TLSv1.2">> -> 'tlsv1.2';
|
|
||||||
<<"TLSv1.3">> -> 'tlsv1.3';
|
|
||||||
_ -> nossl
|
|
||||||
end,
|
|
||||||
CipherSuite = case ssl:str_to_suite(binary_to_list(Cipher)) of
|
|
||||||
#{} = CS -> CS;
|
|
||||||
_ -> nossl
|
|
||||||
end,
|
|
||||||
case {Proto, CipherSuite} of
|
|
||||||
{nossl, _} -> ssl_info(Sock);
|
|
||||||
{_, nossl} -> ssl_info(Sock);
|
|
||||||
_ -> {ok, [{protocol, Proto}, {selected_cipher_suite, CipherSuite}]}
|
|
||||||
end;
|
|
||||||
_ ->
|
|
||||||
ssl_info(Sock)
|
ssl_info(Sock)
|
||||||
end;
|
end;
|
||||||
proxy_ssl_info(Sock, _) ->
|
proxy_ssl_info(Sock, _) ->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue