diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2020-04-20 08:42:32 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2020-04-20 08:42:32 +0200 |
commit | c836dc66a8a10ba88d985ba07511b89d181c6b81 (patch) | |
tree | 7de8b66feaca6e4c17fea42114b69f61a3bd3629 /src/mod_proxy65_service.erl | |
parent | Travis CI: Test against Erlang/OTP 22.3 (diff) |
ejabberd_stun: Set a default 'turn_ip'
Try to resolve the local hostname, use the result as the default
'turn_ip', and only log a warning if that fails. Using the local
hostname's address by default is analogous to mod_proxy65's behavior.
Diffstat (limited to 'src/mod_proxy65_service.erl')
-rw-r--r-- | src/mod_proxy65_service.erl | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/mod_proxy65_service.erl b/src/mod_proxy65_service.erl index fe07ca72..5dcb7994 100644 --- a/src/mod_proxy65_service.erl +++ b/src/mod_proxy65_service.erl @@ -266,19 +266,11 @@ get_streamhost(Host, ServerHost) -> get_endpoint(Host) -> Port = mod_proxy65_opt:port(Host), IP = case mod_proxy65_opt:ip(Host) of - undefined -> get_my_ip(); + undefined -> misc:get_my_ip(); Addr -> Addr end, {Port, IP, tcp}. --spec get_my_ip() -> inet:ip_address(). -get_my_ip() -> - {ok, MyHostName} = inet:gethostname(), - case inet:getaddr(MyHostName, inet) of - {ok, Addr} -> Addr; - {error, _} -> {127, 0, 0, 1} - end. - max_connections(ServerHost) -> mod_proxy65_opt:max_connections(ServerHost). |