Merge branch 'emq20' into proxy-protocol
This commit is contained in:
commit
21576319d6
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
* [@callbay](https://github.com/callbay)
|
||||||
|
|
||||||
|
* [@lsxredrain](https://github.com/lsxredrain)
|
||||||
|
|
||||||
|
* [@hejin1026](https://github.com/hejin1026)
|
||||||
|
|
||||||
|
* [@desoulter](https://github.com/desoulter)
|
||||||
|
|
||||||
|
* [@turtleDeng](https://github.com/turtleDeng)
|
||||||
|
|
||||||
|
* [@Hades32](https://github.com/Hades32)
|
||||||
|
|
||||||
|
* [@huangdan](https://github.com/huangdan)
|
||||||
|
|
||||||
|
* [@phanimahesh](https://github.com/phanimahesh)
|
||||||
|
|
||||||
|
* [@dvliman](https://github.com/dvliman)
|
||||||
|
|
||||||
|
* [@vowstar](https://github.com/vowstar)
|
||||||
|
|
||||||
|
* [@TheWaWaR](https://github.com/TheWaWaR)
|
||||||
|
|
||||||
|
* [@hejin1026](https://github.com/hejin1026)
|
||||||
|
|
||||||
|
* [@farhadi](https://github.com/farhadi)
|
16
Makefile
16
Makefile
|
@ -1,9 +1,8 @@
|
||||||
PROJECT = emqttd
|
PROJECT = emqttd
|
||||||
PROJECT_DESCRIPTION = Erlang MQTT Broker
|
PROJECT_DESCRIPTION = Erlang MQTT Broker
|
||||||
PROJECT_VERSION = 2.0
|
PROJECT_VERSION = 2.0.7
|
||||||
|
|
||||||
DEPS = gproc lager gen_logger esockd mochiweb
|
DEPS = gproc lager gen_logger esockd mochiweb
|
||||||
## getopt pbkdf2 clique time_compat rand_compat
|
|
||||||
|
|
||||||
dep_gproc = git https://github.com/uwiger/gproc
|
dep_gproc = git https://github.com/uwiger/gproc
|
||||||
dep_getopt = git https://github.com/jcomellas/getopt v0.8.2
|
dep_getopt = git https://github.com/jcomellas/getopt v0.8.2
|
||||||
|
@ -11,16 +10,15 @@ dep_lager = git https://github.com/basho/lager master
|
||||||
dep_gen_logger = git https://github.com/emqtt/gen_logger
|
dep_gen_logger = git https://github.com/emqtt/gen_logger
|
||||||
dep_esockd = git https://github.com/emqtt/esockd proxy-protocol
|
dep_esockd = git https://github.com/emqtt/esockd proxy-protocol
|
||||||
dep_mochiweb = git https://github.com/emqtt/mochiweb
|
dep_mochiweb = git https://github.com/emqtt/mochiweb
|
||||||
#dep_clique = git https://github.com/basho/clique
|
|
||||||
#dep_pbkdf2 = git https://github.com/basho/erlang-pbkdf2 2.0.0
|
|
||||||
#dep_time_compat = git https://github.com/lasp-lang/time_compat
|
|
||||||
#dep_rand_compat = git https://github.com/lasp-lang/rand_compat
|
|
||||||
|
|
||||||
TEST_DEPS = cuttlefish
|
|
||||||
dep_cuttlefish = git https://github.com/emqtt/cuttlefish
|
|
||||||
|
|
||||||
ERLC_OPTS += +'{parse_transform, lager_transform}'
|
ERLC_OPTS += +'{parse_transform, lager_transform}'
|
||||||
|
|
||||||
|
TEST_DEPS = cuttlefish emqttc
|
||||||
|
dep_cuttlefish = git https://github.com/emqtt/cuttlefish
|
||||||
|
dep_emqttc = git https://github.com/emqtt/emqttc
|
||||||
|
|
||||||
|
NO_AUTOPATCH = cuttlefish
|
||||||
|
|
||||||
TEST_ERLC_OPTS += +debug_info
|
TEST_ERLC_OPTS += +debug_info
|
||||||
TEST_ERLC_OPTS += +'{parse_transform, lager_transform}'
|
TEST_ERLC_OPTS += +'{parse_transform, lager_transform}'
|
||||||
|
|
||||||
|
|
142
README.md
142
README.md
|
@ -1,33 +1,20 @@
|
||||||
|
|
||||||
## Overview [](https://travis-ci.org/emqtt/emqttd)
|
# *EMQ* - Erlang MQTT Broker [](https://travis-ci.org/emqtt/emqttd)
|
||||||
|
|
||||||
emqttd is a massively scalable and clusterable MQTT V3.1/V3.1.1 broker written in Erlang/OTP.
|
*EMQ* (Erlang MQTT Broker) is a distributed, massively scalable, highly extensible MQTT message broker written in Erlang/OTP.
|
||||||
|
|
||||||
emqttd is fully open source and licensed under the Apache Version 2.0. emqttd implements both MQTT V3.1 and V3.1.1 protocol specifications, and supports WebSocket, STOMP, SockJS, CoAP and MQTT-SN at the same time.
|
*EMQ* is fully open source and licensed under the Apache Version 2.0. *EMQ* implements both MQTT V3.1 and V3.1.1 protocol specifications, and supports MQTT-SN, CoAP, WebSocket, STOMP and SockJS at the same time.
|
||||||
|
|
||||||
emqttd requires Erlang R18+ to build since 1.1 release.
|
*EMQ* provides a scalable, reliable, enterprise-grade MQTT message Hub for IoT, M2M, Smart Hardware and Mobile Messaging Applications.
|
||||||
|
|
||||||
Follow us on Twitter: [@emqtt](https://twitter.com/emqtt)
|
The 1.0 release of the EMQ broker has scaled to 1.3 million concurrent MQTT connections on a 12 Core, 32G CentOS server.
|
||||||
|
|
||||||
## Cluster
|
Please visit [emqtt.io](http://emqtt.io) for more service. Follow us on Twitter: [@emqtt](https://twitter.com/emqtt)
|
||||||
|
|
||||||
The **q.emqtt.com** hosts a public emqttd cluster on [QingCloud](https://qingcloud.com):
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Goals
|
|
||||||
|
|
||||||
The emqttd project is aimed to implement a scalable, distributed, extensible open-source MQTT broker for IoT, M2M and Mobile applications that hope to handle millions of concurrent MQTT clients.
|
|
||||||
|
|
||||||
* Easy to install
|
|
||||||
* Massively scalable
|
|
||||||
* Easy to extend
|
|
||||||
* Solid stable
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Full MQTT V3.1/V3.1.1 protocol specification support
|
* Full MQTT V3.1/V3.1.1 support
|
||||||
* QoS0, QoS1, QoS2 Publish and Subscribe
|
* QoS0, QoS1, QoS2 Publish/Subscribe
|
||||||
* Session Management and Offline Messages
|
* Session Management and Offline Messages
|
||||||
* Retained Message
|
* Retained Message
|
||||||
* Last Will Message
|
* Last Will Message
|
||||||
|
@ -42,17 +29,44 @@ The emqttd project is aimed to implement a scalable, distributed, extensible ope
|
||||||
* IpAddress Authentication
|
* IpAddress Authentication
|
||||||
* Username and Password Authentication
|
* Username and Password Authentication
|
||||||
* Access control based on IpAddress, ClientID, Username
|
* Access control based on IpAddress, ClientID, Username
|
||||||
* Authentication with LDAP, Redis, MySQL, PostgreSQL and HTTP API
|
* LDAP Authentication/ACL
|
||||||
* Cluster brokers on several servers
|
* HTTP Authentication/ACL
|
||||||
|
* MySQL Authentication/ACL
|
||||||
|
* Redis Authentication/ACL
|
||||||
|
* PostgreSQL Authentication/ACL
|
||||||
|
* MongoDB Authentication/ACL
|
||||||
|
* Cluster brokers on several nodes
|
||||||
* Bridge brokers locally or remotely
|
* Bridge brokers locally or remotely
|
||||||
* mosquitto, RSMB bridge
|
* mosquitto, RSMB bridge
|
||||||
* Extensible architecture with Hooks, Modules and Plugins
|
* Extensible architecture with Hooks and Plugins
|
||||||
* Passed eclipse paho interoperability tests
|
* Passed eclipse paho interoperability tests
|
||||||
* Local Subscription
|
* Local Subscription
|
||||||
* Shared Subscription
|
* Shared Subscription
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The *EMQ* broker is cross-platform, which can be deployed on Linux, Unix, Mac, Windows and even Raspberry Pi.
|
||||||
|
|
||||||
|
Download the binary package for your platform from http://emqtt.io/downloads.
|
||||||
|
|
||||||
|
Documentation on [emqtt.io/docs/v2/](http://emqtt.io/docs/v2/install.html), [docs.emqtt.com](http://docs.emqtt.com/en/latest/install.html) for installation and configuration guide.
|
||||||
|
|
||||||
|
## Build From Source
|
||||||
|
|
||||||
|
The *EMQ* broker requires Erlang/OTP R18+ to build.
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/emqtt/emq-relx.git
|
||||||
|
|
||||||
|
cd emq-relx && make
|
||||||
|
|
||||||
|
cd _rel/emqttd && ./bin/emqttd console
|
||||||
|
```
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
|
|
||||||
|
The *EMQ* broker is highly extensible, with many hooks and plugins for customizing the authentication/ACL and integrating with other systems:
|
||||||
|
|
||||||
Plugin | Description
|
Plugin | Description
|
||||||
-----------------------------------------------------------------------|--------------------------------------
|
-----------------------------------------------------------------------|--------------------------------------
|
||||||
[emq_plugin_template](https://github.com/emqtt/emq_plugin_template) | Plugin template and demo
|
[emq_plugin_template](https://github.com/emqtt/emq_plugin_template) | Plugin template and demo
|
||||||
|
@ -76,98 +90,24 @@ Plugin | Descrip
|
||||||
[emq_reloader](https://github.com/emqtt/emq_reloader) | Reloader Plugin
|
[emq_reloader](https://github.com/emqtt/emq_reloader) | Reloader Plugin
|
||||||
[emq_sockjs](https://github.com/emqtt/emq_sockjs) | SockJS(Stomp) Plugin
|
[emq_sockjs](https://github.com/emqtt/emq_sockjs) | SockJS(Stomp) Plugin
|
||||||
|
|
||||||
## Dashboard
|
|
||||||
|
|
||||||
A Web Dashboard will be loaded when the emqttd broker started successfully.
|
|
||||||
|
|
||||||
The Dashboard helps monitor broker's running status, statistics and metrics of MQTT packets.
|
|
||||||
|
|
||||||
Default Address: http://localhost:18083
|
|
||||||
|
|
||||||
Default Login/Password: admin/public
|
|
||||||
|
|
||||||
## Design
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## QuickStart
|
|
||||||
|
|
||||||
Download binary package for Linux, Mac and Freebsd from [http://emqtt.io/downloads](http://emqtt.io/downloads).
|
|
||||||
|
|
||||||
Installing on Ubuntu64, for example:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
unzip emqttd-ubuntu64-2.0-rc.2-20161019.zip && cd emqttd
|
|
||||||
|
|
||||||
# start console
|
|
||||||
./bin/emqttd console
|
|
||||||
|
|
||||||
# start as daemon
|
|
||||||
./bin/emqttd start
|
|
||||||
|
|
||||||
# check status
|
|
||||||
./bin/emqttd_ctl status
|
|
||||||
|
|
||||||
# stop
|
|
||||||
./bin/emqttd stop
|
|
||||||
```
|
|
||||||
|
|
||||||
Installing from source:
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/emqtt/emq-relx.git
|
|
||||||
|
|
||||||
cd emq-relx && make
|
|
||||||
|
|
||||||
cd _rel/emqttd && ./bin/emqttd console
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documents
|
|
||||||
|
|
||||||
Read Documents on [emqttd-docs.rtfd.org](http://emqttd-docs.rtfd.org) for installation and configuration guide.
|
|
||||||
|
|
||||||
## Benchmark
|
|
||||||
|
|
||||||
Latest release of emqttd broker is scaling to 1.3 million MQTT connections on a 12 Core, 32G CentOS server.
|
|
||||||
|
|
||||||
Benchmark 0.12.0-beta on a CentOS6 server with 8 Core, 32G memory from QingCloud:
|
|
||||||
|
|
||||||
250K Connections, 250K Topics, 250K Subscriptions, 4K Qos1 Messages/Sec In, 20K Qos1 Messages/Sec Out, 8M+(bps) In, 40M+(bps) Out Traffic
|
|
||||||
|
|
||||||
Consumed about 3.6G memory and 400+% CPU.
|
|
||||||
|
|
||||||
Benchmark Report: [benchmark for 0.12.0 release](https://github.com/emqtt/emqttd/wiki/benchmark-for-0.12.0-release)
|
|
||||||
|
|
||||||
## Supports
|
## Supports
|
||||||
|
|
||||||
* Twitter: [@emqtt](https://twitter.com/emqtt)
|
* Twitter: [@emqtt](https://twitter.com/emqtt)
|
||||||
* Homepage: http://emqtt.io
|
* Homepage: http://emqtt.io
|
||||||
* Downloads: http://emqtt.io/downloads
|
* Downloads: http://emqtt.io/downloads
|
||||||
* Wiki: https://github.com/emqtt/emqttd/wiki
|
* Documentation: http://emqtt.io/docs/v2/
|
||||||
* Forum: https://groups.google.com/d/forum/emqtt
|
* Forum: https://groups.google.com/d/forum/emqtt
|
||||||
* Mailing List: <emqtt@googlegroups.com>
|
* Mailing List: <emqtt@googlegroups.com>
|
||||||
* Issues: https://github.com/emqtt/emqttd/issues
|
* Issues: https://github.com/emqtt/emqttd/issues
|
||||||
* QQ Group: 12222225
|
* QQ Group: 12222225
|
||||||
|
|
||||||
## Contributors
|
|
||||||
|
|
||||||
* [@callbay](https://github.com/callbay)
|
|
||||||
* [@lsxredrain](https://github.com/lsxredrain)
|
|
||||||
* [@hejin1026](https://github.com/hejin1026)
|
|
||||||
* [@desoulter](https://github.com/desoulter)
|
|
||||||
* [@turtleDeng](https://github.com/turtleDeng)
|
|
||||||
* [@Hades32](https://github.com/Hades32)
|
|
||||||
* [@huangdan](https://github.com/huangdan)
|
|
||||||
* [@phanimahesh](https://github.com/phanimahesh)
|
|
||||||
* [@dvliman](https://github.com/dvliman)
|
|
||||||
|
|
||||||
## Partners
|
## Partners
|
||||||
|
|
||||||
[QingCloud](https://qingcloud.com) is the world’s first IaaS provider that can deliver any number of IT resources in seconds and adopts a second-based billing system. QingCloud is committed to providing a reliable, secure, on-demand and real-time IT resource platform with excellent performance, which includes all components of a complete IT infrastructure system: computing, storage, networking and security.
|
[QingCloud](https://qingcloud.com) is the world’s first IaaS provider that can deliver any number of IT resources in seconds and adopts a second-based billing system. QingCloud is committed to providing a reliable, secure, on-demand and real-time IT resource platform with excellent performance, which includes all components of a complete IT infrastructure system: computing, storage, networking and security.
|
||||||
|
|
||||||
## Author
|
The **q.emqtt.com** hosts a public Four-Node *EMQ* cluster on [QingCloud](https://qingcloud.com):
|
||||||
|
|
||||||
Feng Lee <feng@emqtt.io>
|

|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
%% Banner
|
%% Banner
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-define(COPYRIGHT, "Copyright (C) 2012-2016, Feng Lee <feng@emqtt.io>").
|
-define(COPYRIGHT, "Copyright (C) 2012-2017, Feng Lee <feng@emqtt.io>").
|
||||||
|
|
||||||
-define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0").
|
-define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0").
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2016-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -270,8 +270,7 @@ end}.
|
||||||
%% @doc Allow Anonymous
|
%% @doc Allow Anonymous
|
||||||
{mapping, "mqtt.allow_anonymous", "emqttd.allow_anonymous", [
|
{mapping, "mqtt.allow_anonymous", "emqttd.allow_anonymous", [
|
||||||
{default, false},
|
{default, false},
|
||||||
{datatype, {enum, [true, false]}},
|
{datatype, {enum, [true, false]}}
|
||||||
hidden
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
%% @doc Default ACL File
|
%% @doc Default ACL File
|
||||||
|
@ -283,8 +282,7 @@ end}.
|
||||||
%% @doc Cache ACL for PUBLISH
|
%% @doc Cache ACL for PUBLISH
|
||||||
{mapping, "mqtt.cache_acl", "emqttd.cache_acl", [
|
{mapping, "mqtt.cache_acl", "emqttd.cache_acl", [
|
||||||
{default, true},
|
{default, true},
|
||||||
{datatype, {enum, [true, false]}},
|
{datatype, {enum, [true, false]}}
|
||||||
hidden
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -351,8 +349,7 @@ end}.
|
||||||
%% @doc Topic Priority: 0~255, Default is 0
|
%% @doc Topic Priority: 0~255, Default is 0
|
||||||
{mapping, "mqtt.queue.priority", "emqttd.queue", [
|
{mapping, "mqtt.queue.priority", "emqttd.queue", [
|
||||||
{default, ""},
|
{default, ""},
|
||||||
{datatype, string},
|
{datatype, string}
|
||||||
hidden
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
%% @doc Max queue length. Enqueued messages when persistent client disconnected, or inflight window is full.
|
%% @doc Max queue length. Enqueued messages when persistent client disconnected, or inflight window is full.
|
||||||
|
@ -364,15 +361,13 @@ end}.
|
||||||
%% @doc Low-water mark of queued messages
|
%% @doc Low-water mark of queued messages
|
||||||
{mapping, "mqtt.queue.low_watermark", "emqttd.queue", [
|
{mapping, "mqtt.queue.low_watermark", "emqttd.queue", [
|
||||||
{default, "20%"},
|
{default, "20%"},
|
||||||
{datatype, string},
|
{datatype, string}
|
||||||
hidden
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
%% @doc High-water mark of queued messages
|
%% @doc High-water mark of queued messages
|
||||||
{mapping, "mqtt.queue.high_watermark", "emqttd.queue", [
|
{mapping, "mqtt.queue.high_watermark", "emqttd.queue", [
|
||||||
{default, "60%"},
|
{default, "60%"},
|
||||||
{datatype, string},
|
{datatype, string}
|
||||||
hidden
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
%% @doc Queue Qos0 messages?
|
%% @doc Queue Qos0 messages?
|
||||||
|
@ -425,8 +420,7 @@ end}.
|
||||||
|
|
||||||
{mapping, "mqtt.pubsub.async", "emqttd.pubsub", [
|
{mapping, "mqtt.pubsub.async", "emqttd.pubsub", [
|
||||||
{default, true},
|
{default, true},
|
||||||
{datatype, {enum, [true, false]}},
|
{datatype, {enum, [true, false]}}
|
||||||
hidden
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{translation, "emqttd.pubsub", fun(Conf) ->
|
{translation, "emqttd.pubsub", fun(Conf) ->
|
||||||
|
@ -471,7 +465,7 @@ end}.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
{mapping, "mqtt.listener.tcp", "emqttd.listeners", [
|
{mapping, "mqtt.listener.tcp", "emqttd.listeners", [
|
||||||
{default, 1883},
|
%% {default, 1883},
|
||||||
{datatype, [integer, ip]}
|
{datatype, [integer, ip]}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
@ -487,8 +481,7 @@ end}.
|
||||||
|
|
||||||
{mapping, "mqtt.listener.tcp.rate_limit", "emqttd.listeners", [
|
{mapping, "mqtt.listener.tcp.rate_limit", "emqttd.listeners", [
|
||||||
{default, undefined},
|
{default, undefined},
|
||||||
{datatype, string},
|
{datatype, string}
|
||||||
hidden
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{mapping, "mqtt.listener.tcp.proxy_protocol", "emqttd.listeners", [
|
{mapping, "mqtt.listener.tcp.proxy_protocol", "emqttd.listeners", [
|
||||||
|
@ -530,7 +523,7 @@ end}.
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{mapping, "mqtt.listener.ssl", "emqttd.listeners", [
|
{mapping, "mqtt.listener.ssl", "emqttd.listeners", [
|
||||||
{default, 8883},
|
%% {default, 8883},
|
||||||
{datatype, [integer, ip]}
|
{datatype, [integer, ip]}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
@ -587,7 +580,7 @@ end}.
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{mapping, "mqtt.listener.http", "emqttd.listeners", [
|
{mapping, "mqtt.listener.http", "emqttd.listeners", [
|
||||||
{default, 8883},
|
%% {default, 8083},
|
||||||
{datatype, [integer, ip]}
|
{datatype, [integer, ip]}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
@ -615,9 +608,8 @@ end}.
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{mapping, "mqtt.listener.https", "emqttd.listeners", [
|
{mapping, "mqtt.listener.https", "emqttd.listeners", [
|
||||||
{default, undefined},
|
%%{default, 8084},
|
||||||
{datatype, [integer, ip]},
|
{datatype, [integer, ip]}
|
||||||
hidden
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{mapping, "mqtt.listener.https.acceptors", "emqttd.listeners", [
|
{mapping, "mqtt.listener.https.acceptors", "emqttd.listeners", [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{deps, [
|
{deps, [
|
||||||
{gproc,".*",{git,"https://github.com/uwiger/gproc",""}},{lager,".*",{git,"https://github.com/basho/lager","master"}},{gen_logger,".*",{git,"https://github.com/emqtt/gen_logger",""}},{esockd,".*",{git,"https://github.com/emqtt/esockd","emq20"}},{mochiweb,".*",{git,"https://github.com/emqtt/mochiweb",""}}
|
{gproc,".*",{git,"https://github.com/uwiger/gproc",""}},{lager,".*",{git,"https://github.com/basho/lager","master"}},{gen_logger,".*",{git,"https://github.com/emqtt/gen_logger",""}},{esockd,".*",{git,"https://github.com/emqtt/esockd","master"}},{mochiweb,".*",{git,"https://github.com/emqtt/mochiweb",""}}
|
||||||
]}.
|
]}.
|
||||||
{erl_opts, [{parse_transform,lager_transform}]}.
|
{erl_opts, [{parse_transform,lager_transform}]}.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
%% limitations under the License.
|
%% limitations under the License.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
%% Facade Module for The EMQTT Broker
|
%% Facade Module for The EMQ Broker
|
||||||
|
|
||||||
-module(emqttd).
|
-module(emqttd).
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
-include("emqttd_protocol.hrl").
|
-include("emqttd_protocol.hrl").
|
||||||
|
|
||||||
-export([start/0, env/1, env/2, is_running/1]).
|
-export([start/0, env/1, env/2, is_running/1, stop/0]).
|
||||||
|
|
||||||
%% PubSub API
|
%% PubSub API
|
||||||
-export([subscribe/1, subscribe/2, subscribe/3, publish/1,
|
-export([subscribe/1, subscribe/2, subscribe/3, publish/1,
|
||||||
|
@ -57,6 +57,10 @@
|
||||||
-spec(start() -> ok | {error, any()}).
|
-spec(start() -> ok | {error, any()}).
|
||||||
start() -> application:start(?APP).
|
start() -> application:start(?APP).
|
||||||
|
|
||||||
|
%% @doc Stop emqttd application.
|
||||||
|
-spec(stop() -> ok | {error, any()}).
|
||||||
|
stop() -> application:stop(?APP).
|
||||||
|
|
||||||
%% @doc Environment
|
%% @doc Environment
|
||||||
-spec(env(Key:: atom()) -> {ok, any()} | undefined).
|
-spec(env(Key:: atom()) -> {ok, any()} | undefined).
|
||||||
env(Key) -> application:get_env(?APP, Key).
|
env(Key) -> application:get_env(?APP, Key).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2016-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -195,7 +195,8 @@ sessions(_) ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% @doc Routes Command
|
%% @doc Routes Command
|
||||||
routes(["list"]) ->
|
routes(["list"]) ->
|
||||||
if_could_print(mqtt_route, fun print/1);
|
Routes = emqttd_router:dump(),
|
||||||
|
foreach(fun print/1, Routes);
|
||||||
|
|
||||||
routes(["show", Topic]) ->
|
routes(["show", Topic]) ->
|
||||||
print(mnesia:dirty_read(mqtt_route, bin(Topic)));
|
print(mnesia:dirty_read(mqtt_route, bin(Topic)));
|
||||||
|
@ -506,9 +507,14 @@ print(#mqtt_client{client_id = ClientId, clean_sess = CleanSess, username = User
|
||||||
|
|
||||||
%% print(#mqtt_topic{topic = Topic, flags = Flags}) ->
|
%% print(#mqtt_topic{topic = Topic, flags = Flags}) ->
|
||||||
%% ?PRINT("~s: ~s~n", [Topic, string:join([atom_to_list(F) || F <- Flags], ",")]);
|
%% ?PRINT("~s: ~s~n", [Topic, string:join([atom_to_list(F) || F <- Flags], ",")]);
|
||||||
|
print({route, Routes}) ->
|
||||||
|
foreach(fun print/1, Routes);
|
||||||
|
print({local_route, Routes}) ->
|
||||||
|
foreach(fun print/1, Routes);
|
||||||
print(#mqtt_route{topic = Topic, node = Node}) ->
|
print(#mqtt_route{topic = Topic, node = Node}) ->
|
||||||
?PRINT("~s -> ~s~n", [Topic, Node]);
|
?PRINT("~s -> ~s~n", [Topic, Node]);
|
||||||
|
print({Topic, Node}) ->
|
||||||
|
?PRINT("~s -> ~s~n", [Topic, Node]);
|
||||||
|
|
||||||
print({ClientId, _ClientPid, _Persistent, SessInfo}) ->
|
print({ClientId, _ClientPid, _Persistent, SessInfo}) ->
|
||||||
InfoKeys = [clean_sess,
|
InfoKeys = [clean_sess,
|
||||||
|
@ -528,6 +534,10 @@ print({ClientId, _ClientPid, _Persistent, SessInfo}) ->
|
||||||
|
|
||||||
print(subscription, {Sub, Topic}) when is_pid(Sub) ->
|
print(subscription, {Sub, Topic}) when is_pid(Sub) ->
|
||||||
?PRINT("~p -> ~s~n", [Sub, Topic]);
|
?PRINT("~p -> ~s~n", [Sub, Topic]);
|
||||||
|
print(subscription, {Sub, {_Share, Topic}}) when is_pid(Sub) ->
|
||||||
|
?PRINT("~p -> ~s~n", [Sub, Topic]);
|
||||||
|
print(subscription, {Sub, {_Share, Topic}}) ->
|
||||||
|
?PRINT("~s -> ~s~n", [Sub, Topic]);
|
||||||
print(subscription, {Sub, Topic}) ->
|
print(subscription, {Sub, Topic}) ->
|
||||||
?PRINT("~s -> ~s~n", [Sub, Topic]).
|
?PRINT("~s -> ~s~n", [Sub, Topic]).
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -92,7 +92,7 @@ init([OriginConn, MqttEnv]) ->
|
||||||
SendFun = fun(Packet) ->
|
SendFun = fun(Packet) ->
|
||||||
Data = emqttd_serializer:serialize(Packet),
|
Data = emqttd_serializer:serialize(Packet),
|
||||||
?LOG(debug, "SEND ~p", [Data], #client_state{connname = ConnName}),
|
?LOG(debug, "SEND ~p", [Data], #client_state{connname = ConnName}),
|
||||||
emqttd_metrics:inc('bytes/sent', size(Data)),
|
emqttd_metrics:inc('bytes/sent', iolist_size(Data)),
|
||||||
try Connection:async_send(Data) of
|
try Connection:async_send(Data) of
|
||||||
true -> ok
|
true -> ok
|
||||||
catch
|
catch
|
||||||
|
@ -184,7 +184,7 @@ handle_info(activate_sock, State) ->
|
||||||
hibernate(run_socket(State#client_state{conn_state = running}));
|
hibernate(run_socket(State#client_state{conn_state = running}));
|
||||||
|
|
||||||
handle_info({inet_async, _Sock, _Ref, {ok, Data}}, State) ->
|
handle_info({inet_async, _Sock, _Ref, {ok, Data}}, State) ->
|
||||||
Size = size(Data),
|
Size = iolist_size(Data),
|
||||||
?LOG(debug, "RECV ~p", [Data], State),
|
?LOG(debug, "RECV ~p", [Data], State),
|
||||||
emqttd_metrics:inc('bytes/received', Size),
|
emqttd_metrics:inc('bytes/received', Size),
|
||||||
received(Data, rate_limit(Size, State#client_state{await_recv = false}));
|
received(Data, rate_limit(Size, State#client_state{await_recv = false}));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -77,8 +77,10 @@ remove(Node) ->
|
||||||
ok -> rpc:call(Node, ?MODULE, reboot, []);
|
ok -> rpc:call(Node, ?MODULE, reboot, []);
|
||||||
Error -> Error
|
Error -> Error
|
||||||
end;
|
end;
|
||||||
Error ->
|
{badrpc, nodedown} ->
|
||||||
{error, Error}
|
emqttd_mnesia:remove_from_cluster(Node);
|
||||||
|
{badrpc, Reason} ->
|
||||||
|
{error, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Cluster status
|
%% @doc Cluster status
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -46,7 +46,7 @@ handle_request('GET', "/status", Req) ->
|
||||||
handle_request('POST', "/mqtt/publish", Req) ->
|
handle_request('POST', "/mqtt/publish", Req) ->
|
||||||
case authorized(Req) of
|
case authorized(Req) of
|
||||||
true -> http_publish(Req);
|
true -> http_publish(Req);
|
||||||
false -> Req:respond({401, [], <<"Fobbiden">>})
|
false -> Req:respond({401, [], <<"Unauthorized">>})
|
||||||
end;
|
end;
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -187,8 +187,8 @@ remove_from_cluster(Node) when Node =/= node() ->
|
||||||
ensure_ok(del_schema_copy(Node)),
|
ensure_ok(del_schema_copy(Node)),
|
||||||
ensure_ok(rpc:call(Node, ?MODULE, delete_schema, []));
|
ensure_ok(rpc:call(Node, ?MODULE, delete_schema, []));
|
||||||
{true, false} ->
|
{true, false} ->
|
||||||
ensure_ok(del_schema_copy(Node)),
|
ensure_ok(del_schema_copy(Node));
|
||||||
ensure_ok(rpc:call(Node, ?MODULE, delete_schema, []));
|
%ensure_ok(rpc:call(Node, ?MODULE, delete_schema, []));
|
||||||
{false, _} ->
|
{false, _} ->
|
||||||
{error, node_not_in_cluster}
|
{error, node_not_in_cluster}
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -284,11 +284,11 @@ code_change(_OldVsn, State, _Extra) ->
|
||||||
clean_routes_(Node) ->
|
clean_routes_(Node) ->
|
||||||
Pattern = #mqtt_route{_ = '_', node = Node},
|
Pattern = #mqtt_route{_ = '_', node = Node},
|
||||||
Clean = fun() ->
|
Clean = fun() ->
|
||||||
[mnesia:delete_object(route, R, write) ||
|
[mnesia:delete_object(mqtt_route, R, write) ||
|
||||||
R <- mnesia:match_object(route, Pattern, write)]
|
R <- mnesia:match_object(mqtt_route, Pattern, write)]
|
||||||
end,
|
end,
|
||||||
mnesia:transaction(Clean).
|
mnesia:transaction(Clean).
|
||||||
|
|
||||||
update_stats_() ->
|
update_stats_() ->
|
||||||
emqttd_stats:setstats('routes/count', 'routes/max', mnesia:table_info(route, size)).
|
emqttd_stats:setstats('routes/count', 'routes/max', mnesia:table_info(mqtt_route, size)).
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -332,10 +332,14 @@ handle_cast({unsubscribe, TopicTable}, Session = #session{client_id = Client
|
||||||
end, Subscriptions, TopicTable),
|
end, Subscriptions, TopicTable),
|
||||||
hibernate(Session#session{subscriptions = Subscriptions1});
|
hibernate(Session#session{subscriptions = Subscriptions1});
|
||||||
|
|
||||||
handle_cast({destroy, ClientId}, Session = #session{client_id = ClientId}) ->
|
handle_cast({destroy, ClientId}, Session = #session{client_id = ClientId, client_pid = undefined}) ->
|
||||||
?LOG(warning, "destroyed", [], Session),
|
?LOG(warning, "destroyed", [], Session),
|
||||||
shutdown(destroy, Session);
|
shutdown(destroy, Session);
|
||||||
|
|
||||||
|
handle_cast({destroy, ClientId}, Session = #session{client_id = ClientId, client_pid = OldClientPid}) ->
|
||||||
|
?LOG(warning, "kickout ~p", [OldClientPid], Session),
|
||||||
|
shutdown(conflict, Session);
|
||||||
|
|
||||||
handle_cast({resume, ClientId, ClientPid}, Session = #session{client_id = ClientId,
|
handle_cast({resume, ClientId, ClientPid}, Session = #session{client_id = ClientId,
|
||||||
client_pid = OldClientPid,
|
client_pid = OldClientPid,
|
||||||
clean_sess = CleanSess,
|
clean_sess = CleanSess,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -55,6 +55,7 @@ ws_loop([<<>>], State, _ReplyChannel) ->
|
||||||
ws_loop(Data, State = #wsocket_state{peer = Peer, client_pid = ClientPid,
|
ws_loop(Data, State = #wsocket_state{peer = Peer, client_pid = ClientPid,
|
||||||
parser_fun = ParserFun}, ReplyChannel) ->
|
parser_fun = ParserFun}, ReplyChannel) ->
|
||||||
?WSLOG(debug, Peer, "RECV ~p", [Data]),
|
?WSLOG(debug, Peer, "RECV ~p", [Data]),
|
||||||
|
emqttd_metrics:inc('bytes/received', iolist_size(Data)),
|
||||||
case catch ParserFun(iolist_to_binary(Data)) of
|
case catch ParserFun(iolist_to_binary(Data)) of
|
||||||
{more, NewParser} ->
|
{more, NewParser} ->
|
||||||
State#wsocket_state{parser_fun = NewParser};
|
State#wsocket_state{parser_fun = NewParser};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -62,6 +62,7 @@ unsubscribe(CPid, Topics) ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
init([MqttEnv, WsPid, Req, ReplyChannel]) ->
|
init([MqttEnv, WsPid, Req, ReplyChannel]) ->
|
||||||
|
process_flag(trap_exit, true),
|
||||||
true = link(WsPid),
|
true = link(WsPid),
|
||||||
{ok, Peername} = Req:get(peername),
|
{ok, Peername} = Req:get(peername),
|
||||||
Headers = mochiweb_headers:to_list(
|
Headers = mochiweb_headers:to_list(
|
||||||
|
@ -69,7 +70,7 @@ init([MqttEnv, WsPid, Req, ReplyChannel]) ->
|
||||||
%% SendFun = fun(Payload) -> ReplyChannel({binary, Payload}) end,
|
%% SendFun = fun(Payload) -> ReplyChannel({binary, Payload}) end,
|
||||||
SendFun = fun(Packet) ->
|
SendFun = fun(Packet) ->
|
||||||
Data = emqttd_serializer:serialize(Packet),
|
Data = emqttd_serializer:serialize(Packet),
|
||||||
emqttd_metrics:inc('bytes/sent', size(Data)),
|
emqttd_metrics:inc('bytes/sent', iolist_size(Data)),
|
||||||
ReplyChannel({binary, Data})
|
ReplyChannel({binary, Data})
|
||||||
end,
|
end,
|
||||||
ProtoState = emqttd_protocol:init(Peername, SendFun,
|
ProtoState = emqttd_protocol:init(Peername, SendFun,
|
||||||
|
@ -107,6 +108,7 @@ handle_cast({unsubscribe, Topics}, State) ->
|
||||||
end, State);
|
end, State);
|
||||||
|
|
||||||
handle_cast({received, Packet}, State = #wsclient_state{peer = Peer, proto_state = ProtoState}) ->
|
handle_cast({received, Packet}, State = #wsclient_state{peer = Peer, proto_state = ProtoState}) ->
|
||||||
|
emqttd_metrics:received(Packet),
|
||||||
case emqttd_protocol:received(Packet, ProtoState) of
|
case emqttd_protocol:received(Packet, ProtoState) of
|
||||||
{ok, ProtoState1} ->
|
{ok, ProtoState1} ->
|
||||||
noreply(State#wsclient_state{proto_state = ProtoState1});
|
noreply(State#wsclient_state{proto_state = ProtoState1});
|
||||||
|
@ -170,6 +172,13 @@ handle_info({keepalive, check}, State = #wsclient_state{peer = Peer,
|
||||||
shutdown(keepalive_error, State)
|
shutdown(keepalive_error, State)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
handle_info({'EXIT', WsPid, normal}, State = #wsclient_state{ws_pid = WsPid}) ->
|
||||||
|
stop(normal, State);
|
||||||
|
|
||||||
|
handle_info({'EXIT', WsPid, Reason}, State = #wsclient_state{peer = Peer, ws_pid = WsPid}) ->
|
||||||
|
?WSLOG(error, Peer, "shutdown: ~p",[Reason]),
|
||||||
|
shutdown(Reason, State);
|
||||||
|
|
||||||
handle_info(Info, State = #wsclient_state{peer = Peer}) ->
|
handle_info(Info, State = #wsclient_state{peer = Peer}) ->
|
||||||
?WSLOG(critical, Peer, "Unexpected Info: ~p", [Info]),
|
?WSLOG(critical, Peer, "Unexpected Info: ~p", [Info]),
|
||||||
noreply(State).
|
noreply(State).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -26,25 +26,34 @@
|
||||||
|
|
||||||
-define(CONTENT_TYPE, "application/x-www-form-urlencoded").
|
-define(CONTENT_TYPE, "application/x-www-form-urlencoded").
|
||||||
|
|
||||||
|
-define(MQTT_SSL_TWOWAY, [{cacertfile, "certs/cacert.pem"},
|
||||||
|
{verify, verify_peer},
|
||||||
|
{fail_if_no_peer_cert, true}]).
|
||||||
|
|
||||||
|
-define(MQTT_SSL_CLIENT, [{keyfile, "certs/client-key.pem"},
|
||||||
|
{cacertfile, "certs/cacert.pem"},
|
||||||
|
{certfile, "certs/client-cert.pem"}]).
|
||||||
|
|
||||||
|
|
||||||
all() ->
|
all() ->
|
||||||
[{group, protocol},
|
[{group, protocol},
|
||||||
{group, pubsub},
|
{group, pubsub},
|
||||||
{group, router},
|
{group, router},
|
||||||
{group, session},
|
{group, session},
|
||||||
%%{group, retainer},
|
|
||||||
{group, broker},
|
{group, broker},
|
||||||
{group, metrics},
|
{group, metrics},
|
||||||
{group, stats},
|
{group, stats},
|
||||||
{group, hook},
|
{group, hook},
|
||||||
{group, http},
|
{group, http},
|
||||||
{group, cluster},
|
{group, cluster},
|
||||||
%%{group, backend},
|
|
||||||
{group, alarms},
|
{group, alarms},
|
||||||
{group, cli}].
|
{group, cli}].
|
||||||
|
|
||||||
groups() ->
|
groups() ->
|
||||||
[{protocol, [sequence],
|
[{protocol, [sequence],
|
||||||
[mqtt_connect]},
|
[mqtt_connect,
|
||||||
|
mqtt_ssl_oneway,
|
||||||
|
mqtt_ssl_twoway]},
|
||||||
{pubsub, [sequence],
|
{pubsub, [sequence],
|
||||||
[subscribe_unsubscribe,
|
[subscribe_unsubscribe,
|
||||||
publish, pubsub,
|
publish, pubsub,
|
||||||
|
@ -66,8 +75,6 @@ groups() ->
|
||||||
{hook, [sequence],
|
{hook, [sequence],
|
||||||
[add_delete_hook,
|
[add_delete_hook,
|
||||||
run_hooks]},
|
run_hooks]},
|
||||||
{backend, [sequence],
|
|
||||||
[]},
|
|
||||||
{http, [sequence],
|
{http, [sequence],
|
||||||
[request_status,
|
[request_status,
|
||||||
request_publish
|
request_publish
|
||||||
|
@ -101,9 +108,11 @@ groups() ->
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
application:start(lager),
|
application:start(lager),
|
||||||
DataDir = proplists:get_value(data_dir, Config),
|
DataDir = proplists:get_value(data_dir, Config),
|
||||||
peg_com(DataDir),
|
NewConfig = emqttd_config(DataDir),
|
||||||
start_apps(emqttd, DataDir),
|
Vals = change_opts(ssl_oneway, DataDir, proplists:get_value(emqttd, NewConfig)),
|
||||||
Config.
|
[application:set_env(emqttd, Par, Value) || {Par, Value} <- Vals],
|
||||||
|
application:ensure_all_started(emqttd),
|
||||||
|
[{config, NewConfig} | Config].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
application:stop(emqttd),
|
application:stop(emqttd),
|
||||||
|
@ -129,6 +138,48 @@ connect_broker_(Packet, RecvSize) ->
|
||||||
gen_tcp:close(Sock),
|
gen_tcp:close(Sock),
|
||||||
Data.
|
Data.
|
||||||
|
|
||||||
|
mqtt_ssl_oneway(_) ->
|
||||||
|
{ok, SslOneWay} = emqttc:start_link([{host, "localhost"},
|
||||||
|
{port, 8883},
|
||||||
|
{client_id, <<"ssloneway">>}, ssl]),
|
||||||
|
timer:sleep(10),
|
||||||
|
emqttc:subscribe(SslOneWay, <<"topic">>, qos1),
|
||||||
|
{ok, Pub} = emqttc:start_link([{host, "localhost"},
|
||||||
|
{client_id, <<"pub">>}]),
|
||||||
|
emqttc:publish(Pub, <<"topic">>, <<"SSL oneWay test">>, [{qos, 1}]),
|
||||||
|
timer:sleep(10),
|
||||||
|
receive {publish, _Topic, RM} ->
|
||||||
|
?assertEqual(<<"SSL oneWay test">>, RM)
|
||||||
|
after 1000 -> false
|
||||||
|
end,
|
||||||
|
emqttc:disconnect(SslOneWay),
|
||||||
|
emqttc:disconnect(Pub).
|
||||||
|
|
||||||
|
mqtt_ssl_twoway(Config) ->
|
||||||
|
emqttd_cluster:prepare(),
|
||||||
|
DataDir = proplists:get_value(data_dir, Config),
|
||||||
|
EmqConfig = proplists:get_value(config, Config),
|
||||||
|
Vals = change_opts(ssl_twoway, DataDir, proplists:get_value(emqttd, EmqConfig)),
|
||||||
|
[application:set_env(emqttd, Par, Value) || {Par, Value} <- Vals],
|
||||||
|
emqttd_cluster:reboot(),
|
||||||
|
ClientSSl = [{Key, filename:join([DataDir, File])} ||
|
||||||
|
{Key, File} <- ?MQTT_SSL_CLIENT ],
|
||||||
|
{ok, SslTwoWay} = emqttc:start_link([{host, "localhost"},
|
||||||
|
{port, 8883},
|
||||||
|
{client_id, <<"ssltwoway">>},
|
||||||
|
{ssl, ClientSSl}]),
|
||||||
|
{ok, Sub} = emqttc:start_link([{host, "localhost"},
|
||||||
|
{client_id, <<"sub">>}]),
|
||||||
|
emqttc:subscribe(Sub, <<"topic">>, qos1),
|
||||||
|
emqttc:publish(SslTwoWay, <<"topic">>, <<"ssl client pub message">>, [{qos, 1}]),
|
||||||
|
timer:sleep(10),
|
||||||
|
receive {publish, _Topic, RM} ->
|
||||||
|
?assertEqual(<<"ssl client pub message">>, RM)
|
||||||
|
after 1000 -> false
|
||||||
|
end,
|
||||||
|
emqttc:disconnect(SslTwoWay),
|
||||||
|
emqttc:disconnect(Sub).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% PubSub Test
|
%% PubSub Test
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -480,7 +531,7 @@ cluster_node_down(_) ->
|
||||||
[<<"#">>, <<"a/b/c">>] = [Topic || #mqtt_route{topic = Topic} <- Routes],
|
[<<"#">>, <<"a/b/c">>] = [Topic || #mqtt_route{topic = Topic} <- Routes],
|
||||||
slave:stop(Z),
|
slave:stop(Z),
|
||||||
timer:sleep(1000),
|
timer:sleep(1000),
|
||||||
Routes = lists:sort(emqttd_router:match(<<"a/b/c">>)).
|
[] = lists:sort(emqttd_router:match(<<"a/b/c">>)).
|
||||||
|
|
||||||
set_alarms(_) ->
|
set_alarms(_) ->
|
||||||
AlarmTest = #mqtt_alarm{id = <<"1">>, severity = error, title="alarm title", summary="alarm summary"},
|
AlarmTest = #mqtt_alarm{id = <<"1">>, severity = error, title="alarm title", summary="alarm summary"},
|
||||||
|
@ -593,31 +644,34 @@ slave(node, Node) ->
|
||||||
{ok, N} = slave:start(host(), Node, "-pa ../../ebin -pa ../../deps/*/ebin"),
|
{ok, N} = slave:start(host(), Node, "-pa ../../ebin -pa ../../deps/*/ebin"),
|
||||||
N.
|
N.
|
||||||
|
|
||||||
start_apps(App, DataDir) ->
|
emqttd_config(DataDir) ->
|
||||||
Schema = cuttlefish_schema:files([filename:join([DataDir, atom_to_list(App) ++ ".schema"])]),
|
Schema = cuttlefish_schema:files([filename:join([DataDir, "emqttd.schema"])]),
|
||||||
Conf = conf_parse:file(filename:join([DataDir, atom_to_list(App) ++ ".conf"])),
|
Conf = conf_parse:file(filename:join([DataDir, "emqttd.conf"])),
|
||||||
NewConfig = cuttlefish_generator:map(Schema, Conf),
|
cuttlefish_generator:map(Schema, Conf).
|
||||||
Vals = proplists:get_value(App, NewConfig),
|
|
||||||
[application:set_env(App, Par, Value) || {Par, Value} <- Vals],
|
|
||||||
application:ensure_all_started(App).
|
|
||||||
|
|
||||||
peg_com(DataDir) ->
|
|
||||||
ParsePeg = file2(3, DataDir, "conf_parse.peg"),
|
|
||||||
neotoma:file(ParsePeg),
|
|
||||||
ParseErl = file2(3, DataDir, "conf_parse.erl"),
|
|
||||||
compile:file(ParseErl, []),
|
|
||||||
|
|
||||||
DurationPeg = file2(3, DataDir, "cuttlefish_duration_parse.peg"),
|
|
||||||
neotoma:file(DurationPeg),
|
|
||||||
DurationErl = file2(3, DataDir, "cuttlefish_duration_parse.erl"),
|
|
||||||
compile:file(DurationErl, []).
|
|
||||||
|
|
||||||
|
|
||||||
file2(Times, Dir, FileName) when Times < 1 ->
|
|
||||||
filename:join([Dir, "deps", "cuttlefish","src", FileName]);
|
|
||||||
|
|
||||||
file2(Times, Dir, FileName) ->
|
|
||||||
Dir1 = filename:dirname(Dir),
|
|
||||||
file2(Times - 1, Dir1, FileName).
|
|
||||||
|
|
||||||
|
|
||||||
|
change_opts(SslType, DataDir, Vals) ->
|
||||||
|
Listeners = proplists:get_value(listeners, Vals),
|
||||||
|
NewListeners =
|
||||||
|
lists:foldl(fun({Protocol, Port, Opts} = Listener, Acc) ->
|
||||||
|
case Protocol of
|
||||||
|
ssl ->
|
||||||
|
SslOpts = proplists:get_value(ssl, Opts),
|
||||||
|
Keyfile = filename:join([DataDir, proplists:get_value(keyfile, SslOpts)]),
|
||||||
|
Certfile = filename:join([DataDir, proplists:get_value(certfile, SslOpts)]),
|
||||||
|
TupleList1 = lists:keyreplace(keyfile, 1, SslOpts, {keyfile, Keyfile}),
|
||||||
|
TupleList2 = lists:keyreplace(certfile, 1, TupleList1, {certfile, Certfile}),
|
||||||
|
TupleList3 =
|
||||||
|
case SslType of
|
||||||
|
ssl_twoway->
|
||||||
|
CAfile = filename:join([DataDir, proplists:get_value(cacertfile, ?MQTT_SSL_TWOWAY)]),
|
||||||
|
MutSslList = lists:keyreplace(cacertfile, 1, ?MQTT_SSL_TWOWAY, {cacertfile, CAfile}),
|
||||||
|
lists:merge(TupleList2, MutSslList);
|
||||||
|
_ ->
|
||||||
|
TupleList2
|
||||||
|
end,
|
||||||
|
[{Protocol, Port, [{ssl, TupleList3}]} | Acc];
|
||||||
|
_ ->
|
||||||
|
[Listener | Acc]
|
||||||
|
end
|
||||||
|
end, [], Listeners),
|
||||||
|
lists:keyreplace(listeners, 1, Vals, {listeners, NewListeners}).
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICxjCCAa6gAwIBAgIJAPhU8tv3KMe/MA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV
|
||||||
|
BAMMCE15VGVzdENBMB4XDTE2MTAzMTA3MTU0NVoXDTE3MTAzMTA3MTU0NVowEzER
|
||||||
|
MA8GA1UEAwwITXlUZXN0Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
|
||||||
|
AQCtPcDnmjiVl7ScDhYvGaW+PUgfp7P5cM39mnrW6fkxhA0tgunWpWlYVKbcuh5y
|
||||||
|
4bTNYrOQpcFO3Zg62tva4XEL8O1huqTlGsAeysZ3vWE4/8NGN/3wZy0TKDvwiwOB
|
||||||
|
tbS3C5wcRQZohExL6yEL4XzDGk44x2mIs8/NzeG7Zycqybh9tsCJiHbLiTxnLa24
|
||||||
|
v5USOtlvWye0hA0yUUqc2k7tKVmIMT4A4ulMb2sDVRrSLjyFDTI0c8grlPLfKbG8
|
||||||
|
gpYLsHn9aAjqviyvmJdRLxwauqn+ghNWn1TyZwgAUxpoTtWeC0ilzEt18RP8vZjm
|
||||||
|
eCbEP4qQDDvSCdLrie5CezyxAgMBAAGjHTAbMAwGA1UdEwQFMAMBAf8wCwYDVR0P
|
||||||
|
BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4IBAQBJ/I/QJjU+mgkIaaHImFcIYFrfBirC
|
||||||
|
vDiWo2W+zRh7CbcSf+jsksI99d230ixSDY36CPLKZeZhELST7xWKEELKbPdNbtOO
|
||||||
|
EM10+XteLSXKVNGXfrEbW973eum3FGLobMA9OcH6+qDaf08pibe7kuv10aAgSs/I
|
||||||
|
0Qg5H/UTAKQJKO9hhOgERM/FettuF+WGJaaZZZb9Y2YYBNRf/GtM8KHCjpCX9+XD
|
||||||
|
kdeQGO8Hn10H9tOmggyfdIpsunBcs2/6/exCp8RPBWurN2GSW2RcnS5xVL0r+SVW
|
||||||
|
VOhSDy1JwnNPczpqkqE74qAbAah0dTJFcFWzeGLVk7Kp+2pissAiU3gg
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -0,0 +1,18 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIC9jCCAd6gAwIBAgIBATANBgkqhkiG9w0BAQsFADATMREwDwYDVQQDDAhNeVRl
|
||||||
|
c3RDQTAeFw0xNjEwMzEwNzE1NDVaFw0xNzEwMzEwNzE1NDVaMDkxJjAkBgNVBAMT
|
||||||
|
HWRlbmdoYWlndWlkZU1hY0Jvb2stQWlyLmxvY2FsMQ8wDQYDVQQKEwZzZXJ2ZXIw
|
||||||
|
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC4Ena4vgWrzwUB0hGW1v0v
|
||||||
|
K986FhU5ZdYz5H5MGonfWwv89nR2DlftSDXEvKFyc2MT81GGm16VJv3mVpQJLuKA
|
||||||
|
xLBLY7a1zSrJdugXWy+mgJJTPW6KjTY4jPtfCl6x/yVr8YclVa8XO0JFzOme2LMV
|
||||||
|
Ylc/ixVEa66UpxRNrg5yWHS26KcB1lE3GLERoRBKF7nsyGqGY4X9TypBwglCVoqK
|
||||||
|
3dKVGwCvFur+oPnt/C5pwR6UmUV/Ppf1EaRD7Po+xcyJSeCvszG3FH4iHsDHnjLe
|
||||||
|
DR6lxouvMCb+aKJi9d0xowOjhbKoFMF179t4SVnptQeq+U6ui3cPKUjia7Zh1tZT
|
||||||
|
AgMBAAGjLzAtMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgUgMBMGA1UdJQQMMAoGCCsG
|
||||||
|
AQUFBwMBMA0GCSqGSIb3DQEBCwUAA4IBAQB2jlDPiZfP/whsvvFn43g37QMwX5ST
|
||||||
|
Z5OpmEFnFjAH3ec0PPqPrKYEu00q5wEC+8L6uVH8FHOFf11JLH4wl11/C/mvE92D
|
||||||
|
qZtGG8KCnG2+rk5OJPGX+28Z+OnCZlXOjQ8qd2x5KtIW50JuXJ3cbDRHtF/TVanm
|
||||||
|
Exu+TCBeToNwbcU2sfQnbljkUTj4idUFz0pq3uvw3dA4R1J2foungPAYXSWcVhtb
|
||||||
|
RYtG8epIvkAyyUE5nY3kC05AUml6gSZkrJiYM5I1IJTX1lQ7Pv2yxRBZUtTx33rP
|
||||||
|
ccnsW6tbHTDBG8UDHx4LKHErdWFgCJWI81EUEcTip9g2zCOGTWKnpz+z
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -0,0 +1,18 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIC9jCCAd6gAwIBAgIBAjANBgkqhkiG9w0BAQsFADATMREwDwYDVQQDDAhNeVRl
|
||||||
|
c3RDQTAeFw0xNjEwMzEwNzE1NDZaFw0xNzEwMzEwNzE1NDZaMDkxJjAkBgNVBAMT
|
||||||
|
HWRlbmdoYWlndWlkZU1hY0Jvb2stQWlyLmxvY2FsMQ8wDQYDVQQKEwZjbGllbnQw
|
||||||
|
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmPMkieMtJO4PGIQG30uxI
|
||||||
|
SEoRJoF2w0ufFhZGYCEaqFlHaSoc6nTiCUmnxadDpjkNBs4R6RDfM9zPJ0QdgSFO
|
||||||
|
OJsWgQEHym/EQTcEx11+/2NDZWMJyZdpWZlU57SwHfWDwYa2XFX1bV+pAvhB8cli
|
||||||
|
wCkygTwp1cZcwQpb8TfZySy8r5mwrWq2nhCQPtYqMxjNjpR/UeeZzt+Uh3CEXQ8h
|
||||||
|
omjGinDXnnGwrYwBEP9G6fzTvyCWTyrsWC1Q37oAMzbkwFRoIBSAQWXBv9hgI08s
|
||||||
|
IBYvXnRGKWOJZGxAP4a4TvpFS+nqi+fFVn4ktUfcH3PoSMh7PKavrFT2hQaryLt1
|
||||||
|
AgMBAAGjLzAtMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgeAMBMGA1UdJQQMMAoGCCsG
|
||||||
|
AQUFBwMCMA0GCSqGSIb3DQEBCwUAA4IBAQAeimI8AQBFWiE9/Nf/0radux355mod
|
||||||
|
5vPLbKn6I6nzb/sS/Ug8SMoFnkhncwj+XOgTSliUyWcwOB11UDVJbUIkB/x+Qo3w
|
||||||
|
hvrATTdby2WdFNQvH4X7PmP8asDDN7ZxoLyRmuhjL4avJ3giwRcuQK4cB35b+Lb2
|
||||||
|
p1e7hW81RaV7OEc0o4/vJgPvv9N7wvUuipwJns6PrN7VDn99lT8zWrt2pQ06e2mk
|
||||||
|
jDuXulVpiUtLHJhTnABkCaKiHWCYAFfMjFeRb3gUXKqShzOyDSGWY91YMID/HE4r
|
||||||
|
sVLm2mD1zurue8EmYtQQ6uiJIW9SzvshMHG6EA5QWA1ytoalfePbvf+c
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -0,0 +1,27 @@
|
||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpQIBAAKCAQEApjzJInjLSTuDxiEBt9LsSEhKESaBdsNLnxYWRmAhGqhZR2kq
|
||||||
|
HOp04glJp8WnQ6Y5DQbOEekQ3zPczydEHYEhTjibFoEBB8pvxEE3BMddfv9jQ2Vj
|
||||||
|
CcmXaVmZVOe0sB31g8GGtlxV9W1fqQL4QfHJYsApMoE8KdXGXMEKW/E32cksvK+Z
|
||||||
|
sK1qtp4QkD7WKjMYzY6Uf1Hnmc7flIdwhF0PIaJoxopw155xsK2MARD/Run8078g
|
||||||
|
lk8q7FgtUN+6ADM25MBUaCAUgEFlwb/YYCNPLCAWL150RiljiWRsQD+GuE76RUvp
|
||||||
|
6ovnxVZ+JLVH3B9z6EjIezymr6xU9oUGq8i7dQIDAQABAoIBAFkHEMjPXD96ChZf
|
||||||
|
suXZpgUIAfKxZoBOEv+9+mvyK4h1RGsEHTOjNLmhM7sQFYYbTU52qIHbCdgflE+0
|
||||||
|
vbv3XfjgQ96HdB/SAI1gR7DdfGr5JxX/BE1HkzkubPmVpaT0RnoreJPNW5O24ZZI
|
||||||
|
KuBWNv4V33pWz/uvqy4djAi1ZK3TPDhn9cVCMwV/ISCPlofrNDB/4ZNOMeaQgiR+
|
||||||
|
sGqv+Q0ok2ao7Y04QHPh5i+5o+5oBoiJAO/49q9uPdpO181/8H71jll0QL+h5Off
|
||||||
|
nyWkAAOcgEeX9T4ZnfTUivGdSwB/Y+LS97Ozdr6kp5Fdk8WdDn0DL4fHRrnJ4IJD
|
||||||
|
EIAn/sECgYEA2oOCRBMccr49wbu+cKlkICt/4ARzJWKysdLlK0tYQknkDK1bzoHO
|
||||||
|
9JerRJL4E9bKp8zNlobfP1hWV0TFpwYsK3RvZoLvCwaSHeqUCZ4wQvKrWP1FieJ2
|
||||||
|
5kjO5iMvXiy/kNHdTEXsj0x6RKuUSVgzNIuILvCCQ9Z7JVa/3NWS1SkCgYEAwsF0
|
||||||
|
TWxCjryQv8y4mFSUlyF+y+ntnWAvpe/1Wv3+dNdhsccUfcq3zPMuLEj5DEoIvlTy
|
||||||
|
jLkFLVJ468Ou7S1oSVetVT3wWoLP2eFDEU/sYjjPdf4IMSO1jWIPLC3WV7zsFb62
|
||||||
|
jwG2en1qfz8AxrVl+zj4lWCbgA9Soi41NMiCUW0CgYEAokQEST8T4hVp0OL1Qb5Y
|
||||||
|
bxc+Z4GGbF3Fqw2cRrE1wkwSwGNACLMWl0XF1i95b2oSpdcNWFmhkO2teDLGwAhy
|
||||||
|
ZnaZfzt9/ecMPJEFC7tfxWdlXLj/mawFdW7dzcKVG08JlqZxuoE2cRduuG3duTV5
|
||||||
|
GO0A3TKW2X99hTXNVlV3KzkCgYEAsaE8cHkzY3h9FVKlctqCBC3atiWQQZ+/Fbv8
|
||||||
|
rpdHBE6Fnl4TRIAmj9mk3WNZM2o6+04DQ3JlVGcKPw7ldxGZMnuzbjHmDMeOyAx6
|
||||||
|
3UlmMlfacKXX1unY5zDu4b6U5sU7FsIxQ9GuG55UCebu0E4Wy8G0iJnqeix/k8hN
|
||||||
|
Yu0WXykCgYEAo0kIm7sh9j0+r419Lo2kT4zlzFlNdJEa4+lFVISRqouDuhUO8VFE
|
||||||
|
/ZpGRcqIM7dH6iBM2Htasf7l/hyWKzDEvWCEpa4icicFYAJ92AgK7UBWbNbhueof
|
||||||
|
PyVx5G2o7amvyZNtJYUo4TpJ9eH5YbsBRBqWCJcBUAfrItrprxB1LMs=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
|
@ -0,0 +1,27 @@
|
||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpAIBAAKCAQEAuBJ2uL4Fq88FAdIRltb9LyvfOhYVOWXWM+R+TBqJ31sL/PZ0
|
||||||
|
dg5X7Ug1xLyhcnNjE/NRhptelSb95laUCS7igMSwS2O2tc0qyXboF1svpoCSUz1u
|
||||||
|
io02OIz7Xwpesf8la/GHJVWvFztCRczpntizFWJXP4sVRGuulKcUTa4Oclh0tuin
|
||||||
|
AdZRNxixEaEQShe57MhqhmOF/U8qQcIJQlaKit3SlRsArxbq/qD57fwuacEelJlF
|
||||||
|
fz6X9RGkQ+z6PsXMiUngr7MxtxR+Ih7Ax54y3g0epcaLrzAm/miiYvXdMaMDo4Wy
|
||||||
|
qBTBde/beElZ6bUHqvlOrot3DylI4mu2YdbWUwIDAQABAoIBADXYWNhT5c7LYTiW
|
||||||
|
HcUVIL0CxWr1eMHwk0dcyME0Zi5rMMePxKOgMIJdxDTHxSZ4sHvuimOo4XMaE92k
|
||||||
|
Z+uDxohKgROcmJ735FNIsD3c08SOCb/F0adABaNnQkUcAHVrIKRB4/m85doS4KEQ
|
||||||
|
fyqTU1enC8Svx8nbAhfEBEFw8BLsZD9UnQAEAU5W9S5aKPHNrYRDz5UE0ZP28ixC
|
||||||
|
4PtCew96uCqA0u+xZnWCGawF27FD9P88pcYSJqebF1iFYkXrAwdhAbqewHOqQJXf
|
||||||
|
KJpbpjflBvZr/oTVZ3GAnnHnZDiusFmCKIHB9dKimHMdTFVIU2ikOeJZLtgXsBjb
|
||||||
|
Wn3Fa8kCgYEA2fK0t9NPmELw43D7VoCNeUmu6KmLLd7CeRiQ/OkPLKTqrudnUZGi
|
||||||
|
uMinPFijGTLX3SmByAVOkzMKBQOYF+eB1X24kbRLmL4JKzr04hSqOKqG5gJctC+x
|
||||||
|
V5qQX7ZxrNxFRiSodILbnQN/z1gwZMfrAU0t0EKIKjZR3lpj8CELv1cCgYEA2DWn
|
||||||
|
9V6PCZPcHzoFabhb8DJFglUTHk0zINVe97qldvMvn0MgsjgyS2j954nX8ef7uE1O
|
||||||
|
Cf+9nN709Fu8kEC7/KzWXxP3/O58TfJ6NivCQSr5i0OJLumQMVNrS+u/VG1PaVbS
|
||||||
|
2oCwP3QFayOxZSj9wq2MARd1JkqzHmi8skZLz2UCgYEAgtnv3En3CLBwFe14SPgH
|
||||||
|
eGFfrPpVwGV0luXD7sQyQxiEehwecN+iNZTqqxWAXpmi9np8G83r3f6PrnD4+Kka
|
||||||
|
z0Wa8Yewt3So5paP/chwZnMjaKbUZ64WqET5Fy3fU+wvfyx1IvaJydwW+TK2Y1uP
|
||||||
|
4Yknz1iSjd1tC7VzOPFuLyMCgYBrTFWKQ98glayMIrNFACVAUvKD98yBITbaeImk
|
||||||
|
z5AGNDHSC/JR/+mV2wkGuzXb65DUqiisdaqYC13tVwmBXV7tyqiojrRnZcNyu39D
|
||||||
|
GvxQcw9cuat/CJJyqD97cgeF0qmyUVBa97qAAwgdX51N4sXss0vjzsxosHGsCbZ7
|
||||||
|
kr9UsQKBgQCMTtdCeA+uK/OeJtzf4CYZKR9xllQ+P6gCtbQ7WHuLBX/x+ZhvTC0p
|
||||||
|
qVLVWwFsJ6ivc1f74sy8hZPiePk9fqAqA1JIjDHrof0M3TxRVFvB7dej5XIYVirn
|
||||||
|
521DyZGfE+N7HA7qW5cGKZT0+UYLVp4gnv88nNKDuS18lafy8JRrfQ==
|
||||||
|
-----END RSA PRIVATE KEY-----
|
|
@ -207,8 +207,8 @@ mqtt.listener.ssl.max_clients = 512
|
||||||
## Configuring SSL Options
|
## Configuring SSL Options
|
||||||
## See http://erlang.org/doc/man/ssl.html
|
## See http://erlang.org/doc/man/ssl.html
|
||||||
mqtt.listener.ssl.handshake_timeout = 15
|
mqtt.listener.ssl.handshake_timeout = 15
|
||||||
mqtt.listener.ssl.keyfile = etc/certs/key.pem
|
mqtt.listener.ssl.keyfile = certs/key.pem
|
||||||
mqtt.listener.ssl.certfile = etc/certs/cert.pem
|
mqtt.listener.ssl.certfile = certs/cert.pem
|
||||||
## mqtt.listener.ssl.cacertfile = etc/certs/cacert.pem
|
## mqtt.listener.ssl.cacertfile = etc/certs/cacert.pem
|
||||||
## mqtt.listener.ssl.verify = verify_peer
|
## mqtt.listener.ssl.verify = verify_peer
|
||||||
## mqtt.listener.ssl.fail_if_no_peer_cert = true
|
## mqtt.listener.ssl.fail_if_no_peer_cert = true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2016-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2016-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2016-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
|
Loading…
Reference in New Issue