 
       # if gun used from master
       opts_with_master_keys =
-        Map.put(gun_opts, :tls_opts, tls_opts)
+        gun_opts
+        |> Map.put(:tls_opts, tls_opts)
         |> Map.put(:tcp_opts, tcp_opts)
 
       host =


    defp do_open_conn(uri, %{proxy: {proxy_host, proxy_port}}, gun_opts, tls_opts) do
      connect_opts =
        tunnel_opts(uri)
        |> tunnel_tls_opts(uri.scheme, tls_opts)

      with {:ok, pid} <- :gun.open(proxy_host, proxy_port, gun_opts),


    defp do_open_conn(uri, %{proxy: {proxy_type, proxy_host, proxy_port}}, gun_opts, tls_opts) do
      received_version =
        proxy_type
        |> to_string()
        |> String.last()

      version =
