move to 2.5.5
[anni] / lib / pleroma / helpers / inet_helper.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Helpers.InetHelper do
6   def parse_address(ip) when is_tuple(ip) do
7     {:ok, ip}
8   end
9
10   def parse_address(ip) when is_binary(ip) do
11     ip
12     |> String.to_charlist()
13     |> parse_address()
14   end
15
16   def parse_address(ip) do
17     :inet.parse_address(ip)
18   end
19 end