akkoma/lib/pleroma/gun/api.ex

46 lines
883 B
Elixir
Raw Normal View History

2020-02-11 00:12:57 -07:00
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
2020-02-11 00:12:57 -07:00
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Gun.API do
2020-03-03 09:24:14 -07:00
@behaviour Pleroma.Gun
2020-02-11 00:12:57 -07:00
2020-03-03 09:24:14 -07:00
alias Pleroma.Gun
2020-02-11 00:12:57 -07:00
2020-03-03 09:24:14 -07: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 00:12:57 -07:00
2020-03-03 09:24:14 -07:00
@impl Gun
def open(host, port, opts \\ %{}), do: :gun.open(host, port, Map.take(opts, @gun_keys))
2020-02-11 00:12:57 -07:00
2020-03-03 09:24:14 -07:00
@impl Gun
defdelegate info(pid), to: :gun
2020-02-11 00:12:57 -07:00
2020-03-03 09:24:14 -07:00
@impl Gun
defdelegate close(pid), to: :gun
2020-02-11 00:12:57 -07:00
2020-03-03 09:24:14 -07:00
@impl Gun
defdelegate await_up(pid, timeout \\ 5_000), to: :gun
2020-02-11 00:12:57 -07:00
2020-03-03 09:24:14 -07:00
@impl Gun
defdelegate connect(pid, opts), to: :gun
2020-02-24 09:56:27 -07:00
2020-03-03 09:24:14 -07:00
@impl Gun
defdelegate await(pid, ref), to: :gun
@impl Gun
defdelegate set_owner(pid, owner), to: :gun
2020-02-11 00:12:57 -07:00
end