spc-pleroma/lib/pleroma/gun/api.ex

47 lines
899 B
Elixir
Raw Permalink Normal View History

2020-02-11 07:12:57 +00:00
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 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,
:supervise
2020-03-03 16:24:14 +00:00
]
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