24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-16 22:05:29 +02:00

* src/mod_proxy65/mod_proxy65_services.erl: We now try to get the

address of the component (if registered in DNS) or otherwise get the
IP of the XMPP domain.

SVN Revision: 686
This commit is contained in:
Mickaël Rémond 2006-11-30 13:39:05 +00:00
parent b575394da6
commit 4ab052a475
2 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2006-11-30 Mickael Remond <mickael.remond@process-one.net>
* src/mod_proxy65/mod_proxy65_services.erl: We now try to get the
address of the component (if registered in DNS) or otherwise get the
IP of the XMPP domain.
2006-11-29 Mickael Remond <mickael.remond@process-one.net>
* src/ejabberd_logger_h.erl: Removed useless comments.

View File

@ -180,11 +180,9 @@ parse_options(ServerHost, Opts) ->
ACL = gen_mod:get_opt(access, Opts, all),
Name = gen_mod:get_opt(name, Opts, "SOCKS5 Bytestreams"),
IP = case gen_mod:get_opt(ip, Opts, none) of
none ->
{0,0,0,0};
Addr ->
Addr
end,
none -> get_proxy_or_domainip(ServerHost, MyHost);
Addr -> Addr
end,
[_ | StrIP] = lists:append([[$. | integer_to_list(X)] || X <- inet:ip_to_bytes(IP)]),
StreamAddr = [{"jid", MyHost}, {"host", StrIP}, {"port", integer_to_list(Port)}],
{IP, #state{myhost = MyHost,
@ -193,3 +191,14 @@ parse_options(ServerHost, Opts) ->
port = Port,
stream_addr = StreamAddr,
acl = ACL}}.
%% Return the IP of the proxy host, or if not found, the ip of the xmpp domain
get_proxy_or_domainip(ServerHost, MyHost) ->
case inet:getaddr(MyHost, inet) of
{ok, Addr} -> Addr;
{error, _} ->
case inet:getaddr(ServerHost) of
{ok, Addr} -> Addr;
{error, _} -> {127,0,0,1}
end
end.