0.2.0 upgrade

This commit is contained in:
Ery Lee 2014-12-06 23:10:45 +08:00
parent eb08b6bae0
commit d5b6152aa8
21 changed files with 538 additions and 371 deletions

View File

@ -8,6 +8,7 @@ deps:
clean:
./rebar clean
rm -rf rel/emqtt
dist:
./rebar generate -f
cd rel && ../rebar generate -f

3
TODO
View File

@ -8,9 +8,12 @@
5 cluster...
6. support MQTT3.1.1...
7. python, java test code
8. emqtt_cm to manager clientId, clientPid...
????
{ok, {{simple_one_for_one_terminate, 0, 1},
[{client, {emqtt_client, start_link, []},
temporary, 5000, worker, [emqtt_client]}]}}.
fucking stupid..... esockd locked

View File

@ -1,28 +1,35 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
%%------------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and
%% limitations under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% The Initial Developer of the Original Code is ery.lee@gmail.com
%% Copyright (c) 2012 Ery Lee. All rights reserved.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
%% ---------------------------------
%% banner
%% ---------------------------------
-define(COPYRIGHT, "Copyright (C) 2012 Ery Lee.").
-define(COPYRIGHT, "Copyright (C) 2014, Feng Lee<feng.lee@slimchat.io>").
-define(LICENSE_MESSAGE, "Licensed under the MPL.").
-define(LICENSE_MESSAGE, "Licensed under MIT").
-define(PROTOCOL_VERSION, "MQTT/3.1").
-define(ERTS_MINIMUM, "5.6.3").
-define(ERTS_MINIMUM, "6.0").
%% qos levels
@ -30,10 +37,13 @@
-define(QOS_1, 1).
-define(QOS_2, 2).
-record(mqtt_msg, {retain,
-record(mqtt_msg, {
retain,
qos,
topic,
dup,
message_id,
msgid,
payload,
encoder}).
encoder
}).

View File

@ -1,33 +1,12 @@
{application, emqtt,
[
{description, "erlang mqtt broker"},
{vsn, "0.1.5"},
{modules, [
emqtt,
emqtt_app,
emqtt_auth,
emqtt_auth_anonymous,
emqtt_auth_internal,
emqtt_client,
emqtt_client_sup,
emqtt_client_monitor,
emqtt_ctl,
emqtt_db,
emqtt_frame,
emqtt_lib,
emqtt_listener,
emqtt_net,
emqtt_router,
emqtt_registry,
emqtt_sup,
gen_server2,
priority_queue,
supervisor2
]},
{description, "Erlang MQTT Broker"},
{vsn, git},
{modules, []},
{registered, [emqtt_auth,
emqtt_router,
emqtt_registry,
emqtt_client_monitor]},
emqtt_registry
]},
{applications, [kernel,
stdlib]},
{mod, {emqtt_app, []}},

View File

@ -1,25 +1,30 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The Original Code is eMQTT
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_app).
-author('ery.lee@gmail.com').
-include("emqtt.hrl").
-include_lib("elog/include/elog.hrl").
-include("emqtt_log.hrl").
-behaviour(application).
@ -34,13 +39,22 @@
%% @spec start(atom(), list()) -> {ok, pid()}
%%
start(_StartType, _StartArgs) ->
?INFO("starting emqtt on node '~s'", [node()]),
{ok, Listeners} = application:get_env(listeners),
{ok, SupPid} = emqtt_sup:start_link(Listeners),
print_banner(),
{ok, SupPid} = emqtt_sup:start_link(),
{ok, Listeners} = application:get_env(listen),
emqtt_listener:start(Listeners),
register(emqtt, self()),
?INFO_MSG("emqtt broker is running now."),
print_vsn(),
{ok, SupPid}.
print_banner() ->
?PRINT("starting emqtt on node '~s'~n", [node()]).
print_vsn() ->
{ok, Vsn} = application:get_key(vsn),
{ok, Desc} = application:get_key(description),
?PRINT("~s ~s is running now~n", [Desc, Vsn]).
%%
%% @spec stop(atom) -> 'ok'
%%

View File

@ -1,17 +1,24 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The Original Code is eMQTT
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_auth).
@ -19,7 +26,8 @@
-include("emqtt.hrl").
-include_lib("elog/include/elog.hrl").
-include("emqtt_log.hrl").
-export([start_link/0,
add/2,
@ -38,16 +46,16 @@
-record(state, {authmod, authopts}).
start_link() ->
gen_server2:start_link({local, ?MODULE}, ?MODULE, [], []).
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
check(Username, Password) ->
gen_server2:call(?MODULE, {check, Username, Password}).
gen_server:call(?MODULE, {check, Username, Password}).
add(Username, Password) when is_binary(Username) ->
gen_server2:call(?MODULE, {add, Username, Password}).
gen_server:call(?MODULE, {add, Username, Password}).
delete(Username) when is_binary(Username) ->
gen_server2:cast(?MODULE, {delete, Username}).
gen_server:cast(?MODULE, {delete, Username}).
init([]) ->
{ok, {Name, Opts}} = application:get_env(auth),

View File

@ -1,17 +1,24 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The Original Code is eMQTT
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_auth_internal).

View File

@ -1,23 +1,30 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The Original Code is eMQTT
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_client).
-behaviour(gen_server2).
-behaviour(gen_server).
-export([start_link/0, go/2, info/1]).
-export([start_link/1, info/1]).
-export([init/1,
handle_call/3,
@ -28,12 +35,12 @@
-include("emqtt.hrl").
-include("emqtt_log.hrl").
-include("emqtt_frame.hrl").
-include("emqtt_internal.hrl").
-include_lib("elog/include/elog.hrl").
-define(CLIENT_ID_MAXLEN, 23).
-record(state, {socket,
@ -55,17 +62,36 @@
-define(FRAME_TYPE(Frame, Type),
Frame = #mqtt_frame{ fixed = #mqtt_frame_fixed{ type = Type }}).
start_link() ->
gen_server2:start_link(?MODULE, [], []).
go(Pid, Sock) ->
gen_server2:call(Pid, {go, Sock}, infinity).
start_link(Sock) ->
Res = gen_server:start_link(?MODULE, [Sock], []),
?INFO("~p", [Res]).
info(Pid) ->
gen_server2:call(Pid, info).
gen_server:call(Pid, info).
init([]) ->
{ok, undefined, hibernate, {backoff, 1000, 1000, 10000}}.
init([Sock]) ->
process_flag(trap_exit, true),
esockd_client:ack(Sock),
%%TODO: Move to esockd...
ok = throw_on_error(
inet_error, fun () -> emqtt_net:tune_buffer_size(Sock) end),
{ok, ConnStr} = emqtt_net:connection_string(Sock, inbound),
%FIXME: merge to registry
%%emqtt_client_monitor:mon(self()),
{ok,
control_throttle(
#state{ socket = Sock,
conn_name = ConnStr,
await_recv = false,
connection_state = running,
conserve = false,
parse_state = emqtt_frame:initial_state(),
message_id = 1,
subtopics = [],
awaiting_ack = gb_trees:empty(),
awaiting_rel = gb_trees:empty()})}.
%{ok, undefined, hibernate, {backoff, 1000, 1000, 10000}}.
handle_call(duplicate_id, _From, State=#state{conn_name=ConnName, client_id=ClientId}) ->
?ERROR("Shutdown for duplicate clientid:~s, conn:~s", [ClientId, ConnName]),
@ -78,26 +104,8 @@ handle_call(info, _From, #state{conn_name=ConnName,
{client_id, ClientId}],
{reply, Info, State};
handle_call({go, Sock}, _From, _State) ->
process_flag(trap_exit, true),
ok = throw_on_error(
inet_error, fun () -> emqtt_net:tune_buffer_size(Sock) end),
{ok, ConnStr} = emqtt_net:connection_string(Sock, inbound),
%FIXME: merge to registry
emqtt_client_monitor:mon(self()),
?ERROR("accepting connection (~s)", [ConnStr]),
{reply, ok,
control_throttle(
#state{ socket = Sock,
conn_name = ConnStr,
await_recv = false,
connection_state = running,
conserve = false,
parse_state = emqtt_frame:initial_state(),
message_id = 1,
subtopics = [],
awaiting_ack = gb_trees:empty(),
awaiting_rel = gb_trees:empty()})}.
handle_call(_Req, _From, State) ->
{reply, ok, State}.
handle_cast(Msg, State) ->
{stop, {badmsg, Msg}, State}.
@ -484,6 +492,6 @@ make_msg(#mqtt_frame{
qos = Qos,
topic = Topic,
dup = Dup,
message_id = MessageId,
msgid = MessageId,
payload = Payload}.

View File

@ -1,3 +1,97 @@
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
%client manager
-module(emqtt_cm).
%%client manager...
-author('feng.lee@slimchat.io').
-behaviour(gen_server).
-define(SERVER, ?MODULE).
%% ------------------------------------------------------------------
%% API Function Exports
%% ------------------------------------------------------------------
-export([start_link/0]).
-export([create/2,
destroy/1,
lookup/1]).
%% ------------------------------------------------------------------
%% gen_server Function Exports
%% ------------------------------------------------------------------
-export([init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
terminate/2,
code_change/3]).
%% ------------------------------------------------------------------
%% API Function Definitions
%% ------------------------------------------------------------------
start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
lookup(ClientId) ->
case ets:lookup(emqtt_client, ClientId) of
[{_, Pid}] -> Pid;
[] -> undefined
end.
create(ClientId, Pid) ->
ets:insert(emqtt_client, {ClientId, Pid}).
destroy(ClientId) when is_binary(ClientId) ->
ets:delete(emqtt_client, ClientId);
destroy(Pid) when is_pid(Pid) ->
ets:match_delete(emqtt_client, {{'_', Pid}}).
%% ------------------------------------------------------------------
%% gen_server Function Definitions
%% ------------------------------------------------------------------
init(Args) ->
%on one node
ets:new(emqtt_client, [named_table, public]),
{ok, Args}.
handle_call(_Request, _From, State) ->
{reply, ok, State}.
handle_cast(_Msg, State) ->
{noreply, State}.
handle_info(_Info, State) ->
{noreply, State}.
terminate(_Reason, _State) ->
ok.
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

View File

@ -1,23 +1,30 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The Original Code is eMQTT
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_ctl).
-include("emqtt.hrl").
-include_lib("elog/include/elog.hrl").
-include("emqtt_log.hrl").
-export([status/1,
cluster_info/1,

View File

@ -0,0 +1,29 @@
%%------------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_http).
-export([handle/1]).
handle(Req) ->
Req:not_found().

View File

@ -1,16 +1,24 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
%%------------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and
%% limitations under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% Developer of the eMQTT Code is <ery.lee@gmail.com>
%% Copyright (c) 2012 Ery Lee. All rights reserved.
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_listener).
@ -20,59 +28,22 @@
binary,
{packet, raw},
{reuseaddr, true},
{backlog, 128},
{backlog, 512},
{nodelay, false}
]).
-export([start/1]).
start(Listeners) ->
todo.
[open(Listener) || Listener <- Listeners].
open({mqtt, Port, Options}) ->
MFArgs = {emqtt_client, start_link, []},
Res = esockd:listen(mqtt, Port, Options ++ ?MQTT_SOCKOPTS, MFArgs),
io:format("~p~n", [Res]);
open({http, Port, Options}) ->
MFArgs = {emqtt_http, handle, []},
esockd:listen(http, Port, Options, MFArgs).
spec({Listener, SockOpts}, Callback) ->
[tcp_listener_spec(emqtt_tcp_listener_sup, Address, SockOpts,
mqtt, "TCP Listener", Callback) || Address <- tcp_listener_addresses(Listener)].
tcp_listener_spec(NamePrefix, {IPAddress, Port, Family}, SocketOpts,
Protocol, Label, OnConnect) ->
{emqtt_net:tcp_name(NamePrefix, IPAddress, Port),
{tcp_listener_sup, start_link,
[IPAddress, Port, [Family | SocketOpts],
{?MODULE, listener_started, [Protocol]},
{?MODULE, listener_stopped, [Protocol]},
OnConnect, Label]},
transient, infinity, supervisor, [tcp_listener_sup]}.
tcp_listener_addresses(Port) when is_integer(Port) ->
tcp_listener_addresses_auto(Port);
tcp_listener_addresses({"auto", Port}) ->
%% Variant to prevent lots of hacking around in bash and batch files
tcp_listener_addresses_auto(Port);
tcp_listener_addresses({Host, Port}) ->
%% auto: determine family IPv4 / IPv6 after converting to IP address
tcp_listener_addresses({Host, Port, auto});
tcp_listener_addresses({Host, Port, Family0})
when is_integer(Port) andalso (Port >= 0) andalso (Port =< 65535) ->
[{IPAddress, Port, Family} ||
{IPAddress, Family} <- emqtt_net:getaddr(Host, Family0)];
tcp_listener_addresses({_Host, Port, _Family0}) ->
?ERROR("invalid port ~p - not 0..65535~n", [Port]),
throw({error, {invalid_port, Port}}).
tcp_listener_addresses_auto(Port) ->
lists:append([tcp_listener_addresses(Listener) ||
Listener <- emqtt_net:port_to_listeners(Port)]).
%--------------------------------------------
%TODO: callback
%--------------------------------------------
listener_started(Protocol, IPAddress, Port) ->
%% We need the ip to distinguish e.g. 0.0.0.0 and 127.0.0.1
%% We need the host so we can distinguish multiple instances of the above
%% in a cluster.
?INFO("tcp listener started: ~p ~p:~p", [Protocol, IPAddress, Port]).
listener_stopped(Protocol, IPAddress, Port) ->
?INFO("tcp listener stopped: ~p ~p:~p", [Protocol, IPAddress, Port]).

View File

@ -1,6 +1,28 @@
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_monitor).
-include_lib("elog/include/elog.hrl").
-include("emqtt_log.hrl").
-behavior(gen_server).

View File

@ -1,17 +1,24 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The Original Code is eMQTT
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_net).

View File

@ -1,23 +1,11 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%%
%% The Original Code is eMQTT
%%
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
%%TODO: SHOULD BE REPLACED BY emqtt_cm.erl......
-module(emqtt_registry).
-include("emqtt.hrl").
-include_lib("elog/include/elog.hrl").
-include("emqtt_log.hrl").
-export([start_link/0,
size/0,
@ -40,16 +28,16 @@
%%----------------------------------------------------------------------------
start_link() ->
gen_server2:start_link({local, ?SERVER}, ?MODULE, [], []).
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
size() ->
ets:info(client, size).
register(ClientId, Pid) ->
gen_server2:cast(?SERVER, {register, ClientId, Pid}).
gen_server:cast(?SERVER, {register, ClientId, Pid}).
unregister(ClientId) ->
gen_server2:cast(?SERVER, {unregister, ClientId}).
gen_server:cast(?SERVER, {unregister, ClientId}).
%%----------------------------------------------------------------------------
@ -65,7 +53,7 @@ handle_call(Req, _From, State) ->
handle_cast({register, ClientId, Pid}, State) ->
case ets:lookup(client, ClientId) of
[{_, {OldPid, MRef}}] ->
catch gen_server2:call(OldPid, duplicate_id),
catch gen_server:call(OldPid, duplicate_id),
erlang:demonitor(MRef);
[] ->
ignore

View File

@ -1,16 +1,24 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and
%% limitations under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% Developer of the eMQTT Code is <ery.lee@gmail.com>
%% Copyright (c) 2012 Ery Lee. All rights reserved.
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_retained).
@ -34,7 +42,7 @@
-include("emqtt.hrl").
-include_lib("elog/include/elog.hrl").
-include("emqtt_log.hrl").
-export([start_link/0,
lookup/1,
@ -54,16 +62,16 @@
-record(state, {}).
start_link() ->
gen_server2:start_link({local, ?MODULE}, ?MODULE, [], []).
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
lookup(Topic) ->
ets:lookup(retained_msg, Topic).
insert(Topic, Msg) ->
gen_server2:cast(?MODULE, {insert, Topic, Msg}).
gen_server:cast(?MODULE, {insert, Topic, Msg}).
delete(Topic) ->
gen_server2:cast(?MODULE, {delete, Topic}).
gen_server:cast(?MODULE, {delete, Topic}).
send(Topic, Client) ->
[Client ! {route, Msg} ||{_, Msg} <- lookup(Topic)].

View File

@ -1,28 +1,37 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and
%% limitations under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% Developer of the eMQTT Code is <ery.lee@gmail.com>
%% Copyright (c) 2012 Ery Lee. All rights reserved.
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_router).
-include("emqtt.hrl").
-include("emqtt_log.hrl").
-include("emqtt_frame.hrl").
-include("emqtt_internal.hrl").
-include_lib("stdlib/include/qlc.hrl").
-include_lib("elog/include/elog.hrl").
-export([start_link/0]).
-export([topics/0,
@ -46,16 +55,16 @@
-record(state, {}).
start_link() ->
gen_server2:start_link({local, ?MODULE}, ?MODULE, [], []).
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
topics() ->
mnesia:dirty_all_keys(topic).
subscribe({Topic, Qos}, Client) when is_pid(Client) ->
gen_server2:call(?MODULE, {subscribe, {Topic, Qos}, Client}).
gen_server:call(?MODULE, {subscribe, {Topic, Qos}, Client}).
unsubscribe(Topic, Client) when is_list(Topic) and is_pid(Client) ->
gen_server2:cast(?MODULE, {unsubscribe, Topic, Client}).
gen_server:cast(?MODULE, {unsubscribe, Topic, Client}).
publish(Msg=#mqtt_msg{topic=Topic}) ->
publish(Topic, Msg).
@ -80,7 +89,7 @@ match(Topic) when is_list(Topic) ->
%TODO: this api is really ugly
down(Client) when is_pid(Client) ->
gen_server2:cast(?MODULE, {down, Client}).
gen_server:cast(?MODULE, {down, Client}).
init([]) ->
mnesia:create_table(trie, [

View File

@ -1,17 +1,24 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The Original Code is eMQTT
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_sup).
@ -20,7 +27,7 @@
-behaviour(supervisor).
%% API
-export([start_link/1,
-export([start_link/0,
start_child/1,
start_child/2]).
@ -33,9 +40,8 @@
%% ===================================================================
%% API functions
%% ===================================================================
start_link(Listeners) ->
supervisor:start_link({local, ?MODULE}, ?MODULE, [Listeners]).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
start_child(ChildSpec) when is_tuple(ChildSpec) ->
supervisor:start_child(?MODULE, ChildSpec).
@ -51,26 +57,14 @@ start_child(Mod, Type) when is_atom(Mod) and is_atom(Type) ->
%% Supervisor callbacks
%% ===================================================================
init([Listeners]) ->
Listeners2 = lists:map(fun({Port, Args}) ->
{Port, Args};
({Port, Size, Args}) ->
[{Port+I, Args} || I <- lists:seq(0,Size)]
end, Listeners),
init([]) ->
{ok, { {one_for_all, 5, 10}, [
?CHILD(emqtt_cm, worker),
?CHILD(emqtt_monitor, worker),
?CHILD(emqtt_auth, worker),
?CHILD(emqtt_retained, worker),
?CHILD(emqtt_pubsub, worker),
?CHILD(emqtt_router, worker),
?CHILD(emqtt_registry, worker),
?CHILD(emqtt_client_monitor, worker),
?CHILD(emqtt_client_sup, supervisor)
| listener_children(lists:flatten(Listeners2)) ]}
?CHILD(emqtt_registry, worker)]}
}.
listener_children(Listeners) ->
lists:append([emqtt_listener:spec(Listener,
{emqtt_client_sup, start_client, []}) || Listener <- Listeners]).

View File

@ -1,16 +1,24 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
%%-----------------------------------------------------------------------------
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and
%% limitations under the License.
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% Developer of the eMQTT Code is <ery.lee@gmail.com>
%% Copyright (c) 2012 Ery Lee. All rights reserved.
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
%%------------------------------------------------------------------------------
-module(emqtt_topic).
-import(lists, [reverse/1]).

View File

@ -8,7 +8,7 @@
{sasl_error_logger, {file, "log/emqtt_sasl.log"}}
]},
{mnesia, [
{dir, "var/data"}
{dir, "data"}
]},
{lager, [
{error_logger_redirect, false},

View File

@ -1,23 +1,22 @@
{sys, [
{lib_dirs, ["../..", "../lib", "../plugins"]},
{lib_dirs, ["../apps", "../deps", "../plugins"]},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "emqtt", "0.1.5",
{rel, "emqtt", "0.2.0",
[
kernel,
stdlib,
sasl,
syntax_tools,
ssl,
crypto,
mnesia,
bear,
os_mon,
inets,
goldrush,
lager,
syntax_tools,
elog,
compiler,
gs,
runtime_tools,
appmon,
{folsom, load},
esockd,
mochiweb,
emqtt
]},
{rel, "start_clean", "",
@ -27,26 +26,27 @@
]},
{boot_rel, "emqtt"},
{profile, embedded},
{incl_cond, exclude},
{incl_cond, derived},
%{mod_cond, derived},
{excl_archive_filters, [".*"]}, %% Do not archive built libs
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
{excl_sys_filters, ["^bin/(?!start_clean.boot)",
"^erts.*/bin/(dialyzer|typer)",
"^erts.*/(doc|info|include|lib|man|src)"]},
{excl_app_filters, ["\.gitignore"]},
{app, kernel, [{incl_cond, include}]},
{app, stdlib, [{incl_cond, include}]},
{app, sasl, [{incl_cond, include}]},
{app, mnesia, [{incl_cond, include}]},
{app, compiler, [{incl_cond, include}]},
{app, bear, [{incl_cond, include}]},
{app, goldrush, [{incl_cond, include}]},
{app, lager, [{incl_cond, include}]},
{app, elog, [{incl_cond, include}]},
{app, gs, [{incl_cond, include}]},
{app, runtime_tools, [{incl_cond, include}]},
{app, appmon, [{incl_cond, include}]},
{app, syntax_tools, [{incl_cond, include}]},
{app, folsom, [{incl_cond, include}]},
{app, crypto, [{mod_cond, app}, {incl_cond, include}]},
{app, ssl, [{mod_cond, app}, {incl_cond, include}]},
{app, os_mon, [{mod_cond, app}, {incl_cond, include}]},
{app, syntax_tools, [{mod_cond, app}, {incl_cond, include}]},
{app, public_key, [{mod_cond, app}, {incl_cond, include}]},
{app, mnesia, [{mod_cond, app}, {incl_cond, include}]},
{app, inets, [{mod_cond, app},{incl_cond, include}]},
{app, goldrush, [{mod_cond, app}, {incl_cond, include}]},
{app, lager, [{mod_cond, app}, {incl_cond, include}]},
{app, esockd, [{mod_cond, app}, {incl_cond, include}]},
{app, mochiweb, [{mod_cond, app}, {incl_cond, include}]},
{app, emqtt, [{mod_cond, app}, {incl_cond, include}]}
]}.
@ -57,7 +57,7 @@
{overlay, [
{mkdir, "log/"},
{mkdir, "etc/"},
{mkdir, "var/data/"},
{mkdir, "data/"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{template, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{template, "files/emqtt", "bin/emqtt"},