diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2019-08-25 21:00:58 +0000 |
---|---|---|
committer | Ariadne Conill <ariadne@dereferenced.org> | 2019-08-25 21:00:58 +0000 |
commit | 361940e119321900deca49e7b1d547b779813490 (patch) | |
tree | 10a82fafa65d9d4d6dcf4336ebbfeccdd8dae93a /lib/pleroma/gun/api/gun.ex | |
parent | 6dc24422dc403663f6385272f071e2223c24b2ce (diff) | |
parent | c19d4eeaeebec3d938324fe24b67182fc5d2be4e (diff) | |
download | pleroma-integration/alex.s/gun.tar.gz |
Merge branch 'gun' of git.pleroma.social:alex.s/pleroma into integration/alex.s/gunintegration/alex.s/gun
Diffstat (limited to 'lib/pleroma/gun/api/gun.ex')
-rw-r--r-- | lib/pleroma/gun/api/gun.ex | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/pleroma/gun/api/gun.ex b/lib/pleroma/gun/api/gun.ex new file mode 100644 index 000000000..603dd700e --- /dev/null +++ b/lib/pleroma/gun/api/gun.ex @@ -0,0 +1,43 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Gun.API.Gun do + @behaviour Pleroma.Gun.API + + alias Pleroma.Gun.API + + @gun_keys [ + :connect_timeout, + :http_opts, + :http2_opts, + :protocols, + :retry, + :retry_timeout, + :trace, + :transport, + :tls_opts, + :tcp_opts, + :ws_opts + ] + + @impl API + def open(host, port, opts) do + :gun.open(host, port, Map.take(opts, @gun_keys)) + end + + @impl API + def info(pid), do: :gun.info(pid) + + @impl API + def close(pid), do: :gun.close(pid) + + @impl API + def await_up(pid), do: :gun.await_up(pid) + + @impl API + def connect(pid, opts), do: :gun.connect(pid, opts) + + @impl API + def await(pid, ref), do: :gun.await(pid, ref) +end |