Use Logger.info for {:reject, reason}
[akkoma] / lib / pleroma / gun / api.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Gun.API do
6 @behaviour Pleroma.Gun
7
8 alias Pleroma.Gun
9
10 @gun_keys [
11 :connect_timeout,
12 :http_opts,
13 :http2_opts,
14 :protocols,
15 :retry,
16 :retry_timeout,
17 :trace,
18 :transport,
19 :tls_opts,
20 :tcp_opts,
21 :socks_opts,
22 :ws_opts
23 ]
24
25 @impl Gun
26 def open(host, port, opts \\ %{}), do: :gun.open(host, port, Map.take(opts, @gun_keys))
27
28 @impl Gun
29 defdelegate info(pid), to: :gun
30
31 @impl Gun
32 defdelegate close(pid), to: :gun
33
34 @impl Gun
35 defdelegate await_up(pid, timeout \\ 5_000), to: :gun
36
37 @impl Gun
38 defdelegate connect(pid, opts), to: :gun
39
40 @impl Gun
41 defdelegate await(pid, ref), to: :gun
42
43 @impl Gun
44 defdelegate set_owner(pid, owner), to: :gun
45 end