rename util module to ip2region_util
This commit is contained in:
parent
a3c22a05f8
commit
edeb926a1e
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
-spec search(Ip :: tuple() | list() | binary()) -> Result :: {error, Reason::atom()} | map().
|
-spec search(Ip :: tuple() | list() | binary()) -> Result :: {error, Reason::atom()} | map().
|
||||||
search(Ip) ->
|
search(Ip) ->
|
||||||
case util:ipv4_to_n(Ip) of
|
case ip2region_util:ipv4_to_n(Ip) of
|
||||||
IntIp when is_integer(IntIp) ->
|
IntIp when is_integer(IntIp) ->
|
||||||
case ets:lookup(?IP2REGION_CACHE, IntIp) of
|
case ets:lookup(?IP2REGION_CACHE, IntIp) of
|
||||||
[{_IntIp, Region}] -> Region;
|
[{_IntIp, Region}] -> Region;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
-module(util).
|
-module(ip2region_util).
|
||||||
-export([ipv4_to_n/1]).
|
-export([ipv4_to_n/1]).
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ load_vector_index_aux(<<SPtr:32/little, EPtr:32/little, VectorIndexBin/binary>>,
|
||||||
|
|
||||||
|
|
||||||
search_ip(IoDevice, Ip) ->
|
search_ip(IoDevice, Ip) ->
|
||||||
IntIp = util:ipv4_to_n(Ip),
|
IntIp = ip2region_util:ipv4_to_n(Ip),
|
||||||
case ets:lookup(?IP2REGION_CACHE, IntIp) of
|
case ets:lookup(?IP2REGION_CACHE, IntIp) of
|
||||||
[{_IntIp, RegionInfo}] ->
|
[{_IntIp, RegionInfo}] ->
|
||||||
RegionInfo;
|
RegionInfo;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue