]> granicus.if.org Git - ejabberd/commitdiff
new option "hostname" is added (thanks to Stefan Hepp) (EJAB-838)
authorekhramtsov <ekhramtsov@process-one.net>
Wed, 17 Feb 2010 14:17:33 +0000 (23:17 +0900)
committerekhramtsov <ekhramtsov@process-one.net>
Wed, 17 Feb 2010 14:17:33 +0000 (23:17 +0900)
doc/guide.tex
src/mod_proxy65/mod_proxy65_service.erl

index 4f69afa3b369de85e91a46e5f0bbe702786a0d33..567cbaeb55192137d081fc69ae3b42295716b9ef 100644 (file)
@@ -3515,6 +3515,12 @@ to listen for. Default is an IP address of the service's DNS name, or,
 if fails, \verb|{127,0,0,1}|.
 \titem{\{port, Number\}}\ind{options!port}This option defines port to listen for
 incoming connections. Default is~7777.
+\titem{\{hostname, HostName\}}\ind{options!hostname}Defines a hostname advertised
+by the service when establishing a session with clients. This is useful when
+you run the service behind a NAT. The default is the value of \term{ip} option.
+Examples: \term{"proxy.mydomain.org"}, \term{"200.150.100.50"}. Note that 
+not all clients understand domain names in stream negotiation,
+so you should think twice before setting domain name in this option.
 \titem{\{auth\_type, anonymous|plain\}}\ind{options!auth\_type}SOCKS5 authentication type.
 Possible values are \term{anonymous} and \term{plain}. Default is
 \term{anonymous}.
index 545c7c0e4caf970e2c1684173350c376de86bab7..b2869e3afac36f4b52896aa805067bad7890f163 100644 (file)
@@ -222,8 +222,16 @@ parse_options(ServerHost, Opts) ->
             none -> get_my_ip();
             Addr -> Addr
         end,
-    StrIP = inet_parse:ntoa(IP),
-    StreamAddr = [{"jid", MyHost}, {"host", StrIP}, {"port", integer_to_list(Port)}],
+    HostName = case gen_mod:get_opt(hostname, Opts, none) of
+                  none ->
+                      inet_parse:ntoa(IP);
+                  HostAddr when is_tuple(HostAddr) ->
+                      inet_parse:ntoa(HostAddr);
+                  HostNameStr ->
+                      HostNameStr
+            end,
+    StreamAddr = [{"jid", MyHost}, {"host", HostName},
+                 {"port", integer_to_list(Port)}],
     #state{myhost      = MyHost,
           serverhost  = ServerHost,
           name        = Name,