emqx_gateway.conf.example 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. ##--------------------------------------------------------------------
  2. ## EMQX Gateway configurations
  3. ##--------------------------------------------------------------------
  4. gateway.stomp {
  5. ## How long time the connection will be disconnected if the
  6. ## connection is established but no bytes received
  7. idle_timeout = 30s
  8. ## To control whether write statistics data into ETS table
  9. ## for dashboard to read.
  10. enable_stats = true
  11. ## When publishing or subscribing, prefix all topics with a mountpoint string.
  12. mountpoint = ""
  13. frame {
  14. max_headers = 10
  15. max_headers_length = 1024
  16. max_body_length = 8192
  17. }
  18. clientinfo_override {
  19. username = "${Packet.headers.login}"
  20. password = "${Packet.headers.passcode}"
  21. }
  22. authentication: {
  23. mechanism = password_based
  24. backend = built_in_database
  25. user_id_type = clientid
  26. }
  27. listeners.tcp.default {
  28. bind = 61613
  29. acceptors = 16
  30. max_connections = 1024000
  31. max_conn_rate = 1000
  32. access_rules = [
  33. "allow all"
  34. ]
  35. authentication: {
  36. mechanism = password_based
  37. backend = built_in_database
  38. user_id_type = username
  39. }
  40. ## TCP options
  41. ## See ${example_common_tcp_options} for more information
  42. tcp.active_n = 100
  43. tcp.backlog = 1024
  44. tcp.buffer = 4KB
  45. }
  46. listeners.ssl.default {
  47. bind = 61614
  48. acceptors = 16
  49. max_connections = 1024000
  50. max_conn_rate = 1000
  51. ## TCP options
  52. ## See ${example_common_tcp_options} for more information
  53. tcp.active_n = 100
  54. tcp.backlog = 1024
  55. tcp.buffer = 4KB
  56. ## SSL options
  57. ## See ${example_common_ssl_options} for more information
  58. ssl.versions = ["tlsv1.3", "tlsv1.2", "tlsv1.1", "tlsv1"]
  59. ssl.cacertfile = "{{ platform_etc_dir }}/certs/cacert.pem"
  60. ssl.certfile = "{{ platform_etc_dir }}/certs/cert.pem"
  61. ssl.keyfile = "{{ platform_etc_dir }}/certs/key.pem"
  62. #ssl.verify = verify_none
  63. #ssl.fail_if_no_peer_cert = false
  64. #ssl.server_name_indication = disable
  65. #ssl.secure_renegotiate = false
  66. #ssl.reuse_sessions = false
  67. #ssl.honor_cipher_order = false
  68. #ssl.handshake_timeout = 15s
  69. #ssl.depth = 10
  70. #ssl.password = foo
  71. #ssl.dhfile = path-to-your-file
  72. }
  73. }
  74. gateway.coap {
  75. ## How long time the connection will be disconnected if the
  76. ## connection is established but no bytes received
  77. idle_timeout = 30s
  78. ## To control whether write statistics data into ETS table
  79. ## for dashboard to read.
  80. enable_stats = true
  81. ## When publishing or subscribing, prefix all topics with a mountpoint string.
  82. mountpoint = ""
  83. ## Enable or disable connection mode
  84. ## If true, you need to establish a connection before send any publish/subscribe
  85. ## requests
  86. ##
  87. ## Default: false
  88. #connection_required = false
  89. ## The Notification Message Type.
  90. ## The notification message will be delivered to the CoAP client if a new
  91. ## message received on an observed topic.
  92. ## The type of delivered coap message can be set to:
  93. ## - non: Non-confirmable
  94. ## - con: Confirmable
  95. ## - qos: Mapping from QoS type of the received message.
  96. ## QoS0 -> non, QoS1,2 -> con.
  97. ##
  98. ## Enum: non | con | qos
  99. ## Default: qos
  100. #notify_type = qos
  101. ## The *Default QoS Level* indicator for subscribe request.
  102. ## This option specifies the QoS level for the CoAP Client when establishing
  103. ## a subscription membership, if the subscribe request is not carried `qos`
  104. ## option.
  105. ## The indicator can be set to:
  106. ## - qos0, qos1, qos2: Fixed default QoS level
  107. ## - coap: Dynamic QoS level by the message type of subscribe request
  108. ## * qos0: If the subscribe request is non-confirmable
  109. ## * qos1: If the subscribe request is confirmable
  110. ##
  111. ## Enum: qos0 | qos1 | qos2 | coap
  112. ## Default: coap
  113. #subscribe_qos = coap
  114. ## The *Default QoS Level* indicator for publish request.
  115. ## This option specifies the QoS level for the CoAP Client when publishing a
  116. ## message to EMQX PUB/SUB system, if the publish request is not carried `qos`
  117. ## option.
  118. ## The indicator can be set to:
  119. ## - qos0, qos1, qos2: Fixed default QoS level
  120. ## - coap: Dynamic QoS level by the message type of publish request
  121. ## * qos0: If the publish request is non-confirmable
  122. ## * qos1: If the publish request is confirmable
  123. ##
  124. ## Enum: qos0 | qos1 | qos2 | coap
  125. #publish_qos = coap
  126. listeners.udp.default {
  127. bind = 5683
  128. max_connections = 102400
  129. max_conn_rate = 1000
  130. ## UDP Options
  131. ## See ${example_common_udp_options} for more information
  132. udp.active_n = 100
  133. udp.buffer = 16KB
  134. }
  135. listeners.dtls.default {
  136. bind = 5684
  137. acceptors = 4
  138. max_connections = 102400
  139. max_conn_rate = 1000
  140. ## UDP Options
  141. ## See ${example_common_udp_options} for more information
  142. udp.active_n = 100
  143. udp.buffer = 16KB
  144. ## DTLS Options
  145. ## See #{example_common_dtls_options} for more information
  146. dtls.versions = ["dtlsv1.2", "dtlsv1"]
  147. dtls.keyfile = "{{ platform_etc_dir }}/certs/key.pem"
  148. dtls.certfile = "{{ platform_etc_dir }}/certs/cert.pem"
  149. dtls.cacertfile = "{{ platform_etc_dir }}/certs/cacert.pem"
  150. dtls.handshake_timeout = 15s
  151. }
  152. }
  153. gateway.mqttsn {
  154. ## How long time the connection will be disconnected if the
  155. ## connection is established but no bytes received
  156. idle_timeout = 30s
  157. ## To control whether write statistics data into ETS table
  158. ## for dashboard to read.
  159. enable_stats = true
  160. ## When publishing or subscribing, prefix all topics with a mountpoint string.
  161. mountpoint = ""
  162. ## The MQTT-SN Gateway ID in ADVERTISE message.
  163. gateway_id = 1
  164. ## Enable broadcast this gateway to WLAN
  165. broadcast = true
  166. ## To control whether accept and process the received
  167. ## publish message with qos=-1.
  168. enable_qos3 = true
  169. ## The pre-defined topic name corresponding to the pre-defined topic
  170. ## id of N.
  171. ## Note that the pre-defined topic id of 0 is reserved.
  172. predefined = [
  173. { id = 1
  174. topic = "/predefined/topic/name/hello"
  175. },
  176. { id = 2
  177. topic = "/predefined/topic/name/nice"
  178. }
  179. ]
  180. ### ClientInfo override
  181. clientinfo_override {
  182. username = "mqtt_sn_user"
  183. password = "abc"
  184. }
  185. listeners.udp.default {
  186. bind = 1884
  187. max_connections = 10240000
  188. max_conn_rate = 1000
  189. }
  190. listeners.dtls.default {
  191. bind = 1885
  192. acceptors = 4
  193. max_connections = 102400
  194. max_conn_rate = 1000
  195. ## UDP Options
  196. ## See ${example_common_udp_options} for more information
  197. udp.active_n = 100
  198. udp.buffer = 16KB
  199. ## DTLS Options
  200. ## See #{example_common_dtls_options} for more information
  201. dtls.versions = ["dtlsv1.2", "dtlsv1"]
  202. dtls.keyfile = "{{ platform_etc_dir }}/certs/key.pem"
  203. dtls.certfile = "{{ platform_etc_dir }}/certs/cert.pem"
  204. dtls.cacertfile = "{{ platform_etc_dir }}/certs/cacert.pem"
  205. }
  206. }
  207. gateway.lwm2m {
  208. ## How long time the connection will be disconnected if the
  209. ## connection is established but no bytes received
  210. idle_timeout = 30s
  211. ## To control whether write statistics data into ETS table
  212. ## for dashboard to read.
  213. enable_stats = true
  214. ## When publishing or subscribing, prefix all topics with a mountpoint string.
  215. mountpoint = "lwm2m/${username}"
  216. xml_dir = "{{ platform_etc_dir }}/lwm2m_xml"
  217. ##
  218. ##
  219. lifetime_min = 1s
  220. lifetime_max = 86400s
  221. qmode_time_window = 22s
  222. auto_observe = false
  223. ## always | contains_object_list
  224. update_msg_publish_condition = contains_object_list
  225. translators {
  226. command {
  227. topic = "/dn/#"
  228. qos = 0
  229. }
  230. response {
  231. topic = "/up/resp"
  232. qos = 0
  233. }
  234. notify {
  235. topic = "/up/notify"
  236. qos = 0
  237. }
  238. register {
  239. topic = "/up/resp"
  240. qos = 0
  241. }
  242. update {
  243. topic = "/up/resp"
  244. qos = 0
  245. }
  246. }
  247. listeners.udp.default {
  248. bind = 5783
  249. }
  250. }
  251. gateway.exproto {
  252. ## How long time the connection will be disconnected if the
  253. ## connection is established but no bytes received
  254. idle_timeout = 30s
  255. ## To control whether write statistics data into ETS table
  256. ## for dashboard to read.
  257. enable_stats = true
  258. ## When publishing or subscribing, prefix all topics with a mountpoint string.
  259. mountpoint = ""
  260. ## The gRPC server to accept requests
  261. server {
  262. bind = 9100
  263. #ssl.keyfile:
  264. #ssl.certfile:
  265. #ssl.cacertfile:
  266. }
  267. handler {
  268. address = "http://127.0.0.1:9001"
  269. #ssl.keyfile:
  270. #ssl.certfile:
  271. #ssl.cacertfile:
  272. }
  273. listeners.tcp.default {
  274. bind = 7993
  275. acceptors = 8
  276. max_connections = 10240
  277. max_conn_rate = 1000
  278. }
  279. #listeners.ssl.default: {}
  280. #listeners.udp.default: {}
  281. #listeners.dtls.default: {}
  282. }