Allow IPv6 for Livebook Teams (#2698)

This commit is contained in:
Alexandre de Souza 2024-07-03 18:13:55 -03:00 committed by GitHub
parent 7f1c5f18c5
commit a82b04625d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -267,6 +267,7 @@ defmodule Livebook.Teams.Requests do
defp build_req() do
Req.new(
base_url: Livebook.Config.teams_url(),
inet6: String.ends_with?(Livebook.Config.teams_url(), ".flycast"),
headers: [{"x-lb-version", Livebook.Config.app_version()}]
)
end

View file

@ -29,6 +29,11 @@ defmodule Livebook.Teams.WebSocket do
[]
end
transport_opts =
if String.ends_with?(Livebook.Config.teams_url(), ".flycast"),
do: Keyword.put(transport_opts, :inet6, true),
else: transport_opts
opts = [protocols: [:http1], transport_opts: transport_opts]
with {:ok, conn} <- Mint.HTTP.connect(http_scheme, uri.host, uri.port, opts),