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