Merge remote-tracking branch 'oneric/ipv6' into develop
Some checks are pending
ci/woodpecker/push/build-amd64 Pipeline is pending
ci/woodpecker/push/build-arm64 Pipeline is pending
ci/woodpecker/push/docs Pipeline is pending
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/test Pipeline is pending

This commit is contained in:
Floatingghost 2024-04-11 20:59:49 +01:00
commit 1135935cbe
3 changed files with 28 additions and 5 deletions

View file

@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
## Added
## Changed
## Fixed
- Issue preventing fetching anything from IPv6-only instances
## 2024.03 ## 2024.03
## Added ## Added

View file

@ -288,6 +288,7 @@ defp http_children do
|> Config.get([]) |> Config.get([])
|> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size) |> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size)
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy) |> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|> Pleroma.HTTP.AdapterHelper.ensure_ipv6()
|> Keyword.put(:name, MyFinch) |> Keyword.put(:name, MyFinch)
[{Finch, config}] [{Finch, config}]

View file

@ -65,6 +65,15 @@ def add_pool_size(opts, pool_size) do
|> put_in([:pools, :default, :size], pool_size) |> put_in([:pools, :default, :size], pool_size)
end end
def ensure_ipv6(opts) do
# Default transport opts already enable IPv6, so just ensure they're loaded
opts
|> maybe_add_pools()
|> maybe_add_default_pool()
|> maybe_add_conn_opts()
|> maybe_add_transport_opts()
end
defp maybe_add_pools(opts) do defp maybe_add_pools(opts) do
if Keyword.has_key?(opts, :pools) do if Keyword.has_key?(opts, :pools) do
opts opts
@ -96,11 +105,15 @@ defp maybe_add_conn_opts(opts) do
defp maybe_add_transport_opts(opts) do defp maybe_add_transport_opts(opts) do
transport_opts = get_in(opts, [:pools, :default, :conn_opts, :transport_opts]) transport_opts = get_in(opts, [:pools, :default, :conn_opts, :transport_opts])
unless is_nil(transport_opts) do opts =
opts unless is_nil(transport_opts) do
else opts
put_in(opts, [:pools, :default, :conn_opts, :transport_opts], []) else
end put_in(opts, [:pools, :default, :conn_opts, :transport_opts], [])
end
# IPv6 is disabled and IPv4 enabled by default; ensure we can use both
put_in(opts, [:pools, :default, :conn_opts, :transport_opts, :inet6], true)
end end
@doc """ @doc """