11 lines
373 B
Erlang
11 lines
373 B
Erlang
-module(towerops_ip_address_ffi).
|
|
-export([parse_address/1]).
|
|
|
|
%% Parse a cleaned IP address string using inet:parse_address/1.
|
|
%% Returns {ok, IpTuple} or {error, nil}.
|
|
parse_address(Bin) when is_binary(Bin) ->
|
|
Charlist = binary_to_list(Bin),
|
|
case inet:parse_address(Charlist) of
|
|
{ok, IpTuple} -> {ok, IpTuple};
|
|
{error, _} -> {error, nil}
|
|
end.
|