2020-02-11 00:12:57 -07:00
|
|
|
# Pleroma: A lightweight social networking server
|
2020-03-03 16:16:24 -07:00
|
|
|
# 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,
|
2020-05-08 10:57:11 -06:00
|
|
|
:ws_opts,
|
|
|
|
:supervise
|
2020-03-03 09:24:14 -07:00
|
|
|
]
|
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
|