Skip to content

Commit

Permalink
Stream: added ngx_stream_mqtt_preread_module module.
Browse files Browse the repository at this point in the history
This adds a new directive:

- mqtt_preread: enables extracting information from the MQTT CONNECT message

Syntax:    mqtt_preread on | off;
Default:   mqtt_preread off;
Context:   stream, server


The ngx_stream_mqtt_preread_module module allows extracting information
from the CONNECT message of the Message Queuing Telemetry Transport (MQTT) protocol,
versions 3.1.1 and 5.0.

Processing occurs at the preread stage and populates the following variables:

- $mqtt_preread_clientid
- $mqtt_preread_username
  • Loading branch information
NooboCoder committed Dec 6, 2023
1 parent 8f0b906 commit e149d3e
Show file tree
Hide file tree
Showing 6 changed files with 595 additions and 0 deletions.
11 changes: 11 additions & 0 deletions auto/modules
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,17 @@ if [ $STREAM != NO ]; then

. auto/module
fi

if [ $STREAM_MQTT_PREREAD = YES ]; then
ngx_module_name=ngx_stream_mqtt_preread_module
ngx_module_incs=
ngx_module_deps=
ngx_module_srcs=src/stream/ngx_stream_mqtt_preread_module.c
ngx_module_libs=
ngx_module_link=$STREAM_MQTT_PREREAD

. auto/module
fi
fi


Expand Down
4 changes: 4 additions & 0 deletions auto/options
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ STREAM_UPSTREAM_LEAST_CONN=YES
STREAM_UPSTREAM_RANDOM=YES
STREAM_UPSTREAM_ZONE=YES
STREAM_SSL_PREREAD=NO
STREAM_MQTT_PREREAD=NO

DYNAMIC_MODULES=
DYNAMIC_MODULES_SRCS=
Expand Down Expand Up @@ -338,6 +339,8 @@ use the \"--with-mail_ssl_module\" option instead"
STREAM_GEOIP=DYNAMIC ;;
--with-stream_ssl_preread_module)
STREAM_SSL_PREREAD=YES ;;
--with-stream_mqtt_preread_module)
STREAM_MQTT_PREREAD=YES ;;
--without-stream_limit_conn_module)
STREAM_LIMIT_CONN=NO ;;
--without-stream_access_module) STREAM_ACCESS=NO ;;
Expand Down Expand Up @@ -564,6 +567,7 @@ cat << END
--with-stream_geoip_module enable ngx_stream_geoip_module
--with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module
--with-stream_ssl_preread_module enable ngx_stream_ssl_preread_module
--with-stream_mqtt_preread_module enable ngx_stream_mqtt_preread_module
--without-stream_limit_conn_module disable ngx_stream_limit_conn_module
--without-stream_access_module disable ngx_stream_access_module
--without-stream_geo_module disable ngx_stream_geo_module
Expand Down
13 changes: 13 additions & 0 deletions docs/xml/angie/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@

<changes ver="1.4.0" date="">

<change type="feature">
<para lang="ru">
директива "mqtt_preread" модуля "stream", позволяющая помещать имя пользователя
и идентификатор клиента из пакета CONNECT протокола MQTT в переменные
$mqtt_preread_username и $mqtt_preread_clientid.
</para>
<para lang="en">
"mqtt_preread" directive in the "stream" module, which allows extracting
the username and client id from the CONNECT packet of the MQTT protocol into
the $mqtt_preread_username and $mqtt_preread_clientid variables.
</para>
</change>

<change type="feature">
<para lang="ru">
ограничение скорости отдачи MP4-файлов клиенту пропорционально битрейту
Expand Down
Loading

0 comments on commit e149d3e

Please sign in to comment.