diff options
Diffstat (limited to 'src/mod_proxy65.erl')
-rw-r--r-- | src/mod_proxy65.erl | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/mod_proxy65.erl b/src/mod_proxy65.erl index 6eced10b..2737de7a 100644 --- a/src/mod_proxy65.erl +++ b/src/mod_proxy65.erl @@ -5,7 +5,7 @@ %%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru> %%% %%% -%%% ejabberd, Copyright (C) 2002-2015 ProcessOne +%%% ejabberd, Copyright (C) 2002-2016 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -27,6 +27,8 @@ -author('xram@jabber.ru'). +-protocol({xep, 65, '1.8'}). + -behaviour(gen_mod). -behaviour(supervisor). @@ -37,8 +39,7 @@ %% supervisor callbacks. -export([init/1]). -%% API. --export([start_link/2]). +-export([start_link/2, mod_opt_type/1]). -define(PROCNAME, ejabberd_mod_proxy65). @@ -82,3 +83,35 @@ init([Host, Opts]) -> {ok, {{one_for_one, 10, 1}, [StreamManager, StreamSupervisor, Service]}}. + +mod_opt_type(auth_type) -> + fun (plain) -> plain; + (anonymous) -> anonymous + end; +mod_opt_type(recbuf) -> + fun (I) when is_integer(I), I > 0 -> I end; +mod_opt_type(shaper) -> + fun (A) when is_atom(A) -> A end; +mod_opt_type(sndbuf) -> + fun (I) when is_integer(I), I > 0 -> I end; +mod_opt_type(access) -> + fun (A) when is_atom(A) -> A end; +mod_opt_type(host) -> fun iolist_to_binary/1; +mod_opt_type(hostname) -> fun iolist_to_binary/1; +mod_opt_type(ip) -> + fun (S) -> + {ok, Addr} = + inet_parse:address(binary_to_list(iolist_to_binary(S))), + Addr + end; +mod_opt_type(name) -> fun iolist_to_binary/1; +mod_opt_type(port) -> + fun (P) when is_integer(P), P > 0, P < 65536 -> P end; +mod_opt_type(max_connections) -> + fun (I) when is_integer(I), I > 0 -> I; + (infinity) -> infinity + end; +mod_opt_type(_) -> + [auth_type, recbuf, shaper, sndbuf, + access, host, hostname, ip, name, port, + max_connections]. |