Add mqtt.strict_mode configuration (#3069)
Add mqtt.strict_mode configuration
This commit is contained in:
parent
3def009883
commit
a540958846
|
@ -542,6 +542,11 @@ mqtt.shared_subscription = true
|
||||||
## Value: true | false
|
## Value: true | false
|
||||||
mqtt.ignore_loop_deliver = false
|
mqtt.ignore_loop_deliver = false
|
||||||
|
|
||||||
|
## Whether to parse the MQTT frame in strict mode
|
||||||
|
##
|
||||||
|
## Value: true | false
|
||||||
|
mqtt.strict_mode = false
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
## Zones
|
## Zones
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
|
@ -751,6 +756,11 @@ zone.external.use_username_as_clientid = false
|
||||||
## Value: true | false
|
## Value: true | false
|
||||||
zone.external.ignore_loop_deliver = false
|
zone.external.ignore_loop_deliver = false
|
||||||
|
|
||||||
|
## Whether to parse the MQTT frame in strict mode
|
||||||
|
##
|
||||||
|
## Value: true | false
|
||||||
|
zone.external.strict_mode = false
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
## Internal Zone
|
## Internal Zone
|
||||||
|
|
||||||
|
@ -832,6 +842,11 @@ zone.internal.use_username_as_clientid = false
|
||||||
## Value: true | false
|
## Value: true | false
|
||||||
zone.internal.ignore_loop_deliver = false
|
zone.internal.ignore_loop_deliver = false
|
||||||
|
|
||||||
|
## Whether to parse the MQTT frame in strict mode
|
||||||
|
##
|
||||||
|
## Value: true | false
|
||||||
|
zone.internal.strict_mode = false
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
## Listeners
|
## Listeners
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
|
|
|
@ -715,6 +715,12 @@ end}.
|
||||||
{datatype, {enum, [true, false]}}
|
{datatype, {enum, [true, false]}}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
%% @doc Whether to parse the MQTT frame in strict mode
|
||||||
|
{mapping, "mqtt.strict_mode", "emqx.strict_mode", [
|
||||||
|
{default, false},
|
||||||
|
{datatype, {enum, [true, false]}}
|
||||||
|
]}.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Zones
|
%% Zones
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -931,14 +937,14 @@ end}.
|
||||||
{datatype, {enum, [true, false]}}
|
{datatype, {enum, [true, false]}}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
%% @doc Whether to parse the MQTT frame in strict mode
|
||||||
|
{mapping, "zone.$name.strict_mode", "emqx.zones", [
|
||||||
|
{default, false},
|
||||||
|
{datatype, {enum, [true, false]}}
|
||||||
|
]}.
|
||||||
|
|
||||||
{translation, "emqx.zones", fun(Conf) ->
|
{translation, "emqx.zones", fun(Conf) ->
|
||||||
Mapping = fun("retain_available", Val) ->
|
Mapping = fun("publish_limit", Val) ->
|
||||||
{retain_available, Val};
|
|
||||||
("wildcard_subscription", Val) ->
|
|
||||||
{wildcard_subscription, Val};
|
|
||||||
("shared_subscription", Val) ->
|
|
||||||
{shared_subscription, Val};
|
|
||||||
("publish_limit", Val) ->
|
|
||||||
[L, D] = string:tokens(Val, ", "),
|
[L, D] = string:tokens(Val, ", "),
|
||||||
Limit = list_to_integer(L),
|
Limit = list_to_integer(L),
|
||||||
Duration = case cuttlefish_duration:parse(D, s) of
|
Duration = case cuttlefish_duration:parse(D, s) of
|
||||||
|
@ -1000,8 +1006,6 @@ end}.
|
||||||
end, #{}, string:tokens(Val, ",")),
|
end, #{}, string:tokens(Val, ",")),
|
||||||
{mqueue_priorities, MqueuePriorities}
|
{mqueue_priorities, MqueuePriorities}
|
||||||
end;
|
end;
|
||||||
("mountpoint", Val) ->
|
|
||||||
{mountpoint, iolist_to_binary(Val)};
|
|
||||||
(Opt, Val) ->
|
(Opt, Val) ->
|
||||||
{list_to_atom(Opt), Val}
|
{list_to_atom(Opt), Val}
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -141,7 +141,7 @@ mqtt_frame_options(Zone) ->
|
||||||
|
|
||||||
-spec(mqtt_strict_mode(zone()) -> boolean()).
|
-spec(mqtt_strict_mode(zone()) -> boolean()).
|
||||||
mqtt_strict_mode(Zone) ->
|
mqtt_strict_mode(Zone) ->
|
||||||
get_env(Zone, mqtt_strict_mode, false).
|
get_env(Zone, strict_mode, false).
|
||||||
|
|
||||||
-spec(max_packet_size(zone()) -> integer()).
|
-spec(max_packet_size(zone()) -> integer()).
|
||||||
max_packet_size(Zone) ->
|
max_packet_size(Zone) ->
|
||||||
|
|
Loading…
Reference in New Issue