2020-02-11 08:12:57 +01:00
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-13 07:49:20 +01:00
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2020-02-11 08:12:57 +01:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Gun.API do
|
2020-03-03 17:24:14 +01:00
|
|
|
@behaviour Pleroma.Gun
|
2020-02-11 08:12:57 +01:00
|
|
|
|
2020-03-03 17:24:14 +01:00
|
|
|
alias Pleroma.Gun
|
2020-02-11 08:12:57 +01:00
|
|
|
|
2020-03-03 17:24:14 +01:00
|
|
|
@gun_keys [
|
|
|
|
:connect_timeout,
|
|
|
|
:http_opts,
|
|
|
|
:http2_opts,
|
|
|
|
:protocols,
|
|
|
|
:retry,
|
|
|
|
:retry_timeout,
|
|
|
|
:trace,
|
|
|
|
:transport,
|
|
|
|
:tls_opts,
|
|
|
|
:tcp_opts,
|
|
|
|
:socks_opts,
|
2020-05-08 18:57:11 +02:00
|
|
|
:ws_opts,
|
|
|
|
:supervise
|
2020-03-03 17:24:14 +01:00
|
|
|
]
|
2020-02-11 08:12:57 +01:00
|
|
|
|
2020-03-03 17:24:14 +01:00
|
|
|
@impl Gun
|
|
|
|
def open(host, port, opts \\ %{}), do: :gun.open(host, port, Map.take(opts, @gun_keys))
|
2020-02-11 08:12:57 +01:00
|
|
|
|
2020-03-03 17:24:14 +01:00
|
|
|
@impl Gun
|
|
|
|
defdelegate info(pid), to: :gun
|
2020-02-11 08:12:57 +01:00
|
|
|
|
2020-03-03 17:24:14 +01:00
|
|
|
@impl Gun
|
|
|
|
defdelegate close(pid), to: :gun
|
2020-02-11 08:12:57 +01:00
|
|
|
|
2020-03-03 17:24:14 +01:00
|
|
|
@impl Gun
|
|
|
|
defdelegate await_up(pid, timeout \\ 5_000), to: :gun
|
2020-02-11 08:12:57 +01:00
|
|
|
|
2020-03-03 17:24:14 +01:00
|
|
|
@impl Gun
|
|
|
|
defdelegate connect(pid, opts), to: :gun
|
2020-02-24 17:56:27 +01:00
|
|
|
|
2020-03-03 17:24:14 +01:00
|
|
|
@impl Gun
|
|
|
|
defdelegate await(pid, ref), to: :gun
|
|
|
|
|
|
|
|
@impl Gun
|
|
|
|
defdelegate set_owner(pid, owner), to: :gun
|
2020-02-11 08:12:57 +01:00
|
|
|
end
|