diff options
author | minibikini <egor@kislitsyn.com> | 2020-10-27 18:59:19 +0000 |
---|---|---|
committer | minibikini <egor@kislitsyn.com> | 2020-10-27 18:59:19 +0000 |
commit | 1bfd8528bbc71c8c34253eb245de7df498064fb4 (patch) | |
tree | 97387260c85bb6b5505924de806110d8f71eb3fc /lib/pleroma/helpers | |
parent | 18a91d85e59eb67a2d58a28aae732c34b75ebe97 (diff) | |
parent | 5aff4799515c141cb0a42686733b2f40faba6f86 (diff) | |
download | pleroma-1bfd8528bbc71c8c34253eb245de7df498064fb4.tar.gz |
Merge branch 'develop' into 'feature/local-only-scope'
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'lib/pleroma/helpers')
-rw-r--r-- | lib/pleroma/helpers/inet_helper.ex | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/pleroma/helpers/inet_helper.ex b/lib/pleroma/helpers/inet_helper.ex new file mode 100644 index 000000000..126f82381 --- /dev/null +++ b/lib/pleroma/helpers/inet_helper.ex @@ -0,0 +1,19 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Helpers.InetHelper do + def parse_address(ip) when is_tuple(ip) do + {:ok, ip} + end + + def parse_address(ip) when is_binary(ip) do + ip + |> String.to_charlist() + |> parse_address() + end + + def parse_address(ip) do + :inet.parse_address(ip) + end +end |