diff --git a/lib/vintage_net/interface/udhcpc.ex b/lib/vintage_net/interface/udhcpc.ex index ccb944ff..da60553a 100644 --- a/lib/vintage_net/interface/udhcpc.ex +++ b/lib/vintage_net/interface/udhcpc.ex @@ -6,6 +6,7 @@ defmodule VintageNet.Interface.Udhcpc do require Logger @doc """ + Handle deconfig reports from udhcpc """ @impl true def deconfig(ifname, info) do @@ -40,6 +41,7 @@ defmodule VintageNet.Interface.Udhcpc do end @doc """ + Handle leasefail reports from udhcpc """ @impl true def leasefail(ifname, _info) do @@ -54,6 +56,7 @@ defmodule VintageNet.Interface.Udhcpc do end @doc """ + Handle nak reports from udhcpc """ @impl true def nak(ifname, info) do @@ -77,6 +80,7 @@ defmodule VintageNet.Interface.Udhcpc do end @doc """ + Handle renew reports from udhcpc """ @impl true def renew(ifname, info) do @@ -145,6 +149,7 @@ defmodule VintageNet.Interface.Udhcpc do end @doc """ + Handle bound reports from udhcpc """ @impl true def bound(ifname, info) do diff --git a/lib/vintage_net/interface/udhcpd.ex b/lib/vintage_net/interface/udhcpd.ex index 79c042b4..9269fcc6 100644 --- a/lib/vintage_net/interface/udhcpd.ex +++ b/lib/vintage_net/interface/udhcpd.ex @@ -19,18 +19,21 @@ defmodule VintageNet.Interface.Udhcpd do end end - @doc "Parse the leases file from udhcpd" + @doc """ + Parse the leases file from udhcpd + """ + @spec parse_leases(Path.t()) :: {:ok, [map()]} | {:error, File.posix()} def parse_leases(path) do with {:ok, <<_timestamp::binary-size(8), rest::binary>>} <- File.read(path) do do_parse_leases(rest, []) end end - def do_parse_leases( - <>, - acc - ) do + defp do_parse_leases( + <>, + acc + ) do lease = %{ leasetime: leasetime, lease_nip: Enum.join([ip1, ip2, ip3, ip4], "."), @@ -52,5 +55,5 @@ defmodule VintageNet.Interface.Udhcpd do do_parse_leases(rest, [lease | acc]) end - def do_parse_leases(<<>>, acc), do: {:ok, acc} + defp do_parse_leases(<<>>, acc), do: {:ok, acc} end