fix: add proxy_protocol_timeout/access_rules default value
This commit is contained in:
parent
f8a2831c5d
commit
17ef987d25
|
@ -43,7 +43,7 @@ listeners.tcp.default {
|
|||
##
|
||||
## @doc listeners.tcp.<name>.access_rules
|
||||
## ValueType: Array<AccessRules>
|
||||
## Default: []
|
||||
## Default: ["allow all"]
|
||||
## Examples:
|
||||
## access_rules: [
|
||||
## "deny 192.168.0.0/24",
|
||||
|
|
|
@ -1677,7 +1677,8 @@ mqtt_listener() ->
|
|||
#{
|
||||
desc =>
|
||||
"The access control rules for this listener.<br/>"
|
||||
"See: https://github.com/emqtt/esockd#allowdeny"
|
||||
"See: https://github.com/emqtt/esockd#allowdeny",
|
||||
default => [<<"allow all">>]
|
||||
}
|
||||
)},
|
||||
{"proxy_protocol",
|
||||
|
@ -1697,7 +1698,8 @@ mqtt_listener() ->
|
|||
#{
|
||||
desc =>
|
||||
"Timeout for proxy protocol. EMQX will close the TCP connection "
|
||||
"if proxy protocol packet is not received within the timeout."
|
||||
"if proxy protocol packet is not received within the timeout.",
|
||||
default => "3s"
|
||||
}
|
||||
)},
|
||||
{?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME,
|
||||
|
|
|
@ -580,8 +580,8 @@ create(Path, Conf) ->
|
|||
remove(Path) ->
|
||||
wrap(emqx_conf:remove(Path, ?OPTS(cluster))).
|
||||
|
||||
wrap({error, {post_config_update, ?MODULE, Reason}}) -> {error, Reason};
|
||||
wrap({error, {pre_config_update, ?MODULE, Reason}}) -> {error, Reason};
|
||||
wrap({error, {post_config_update, emqx_listeners, Reason}}) -> {error, Reason};
|
||||
wrap({error, {pre_config_update, emqx_listeners, Reason}}) -> {error, Reason};
|
||||
wrap({error, Reason}) -> {error, Reason};
|
||||
wrap(Ok) -> Ok.
|
||||
|
||||
|
|
|
@ -39,14 +39,14 @@ t_list_listeners(_) ->
|
|||
?assertEqual(length(Expect), length(Res)),
|
||||
ok.
|
||||
|
||||
t_crud_listeners_by_id(_) ->
|
||||
t_crud_listeners_tcp_by_id(_) ->
|
||||
TcpListenerId = <<"tcp:default">>,
|
||||
NewListenerId = <<"tcp:new">>,
|
||||
TcpPath = emqx_mgmt_api_test_util:api_path(["listeners", TcpListenerId]),
|
||||
NewPath = emqx_mgmt_api_test_util:api_path(["listeners", NewListenerId]),
|
||||
TcpListener = request(get, TcpPath, [], []),
|
||||
|
||||
%% create
|
||||
%% create with full options
|
||||
?assertEqual({error, not_found}, is_running(NewListenerId)),
|
||||
?assertMatch({error, {"HTTP/1.1", 404, _}}, request(get, NewPath, [], [])),
|
||||
NewConf = TcpListener#{
|
||||
|
@ -59,6 +59,22 @@ t_crud_listeners_by_id(_) ->
|
|||
?assertMatch(Create, Get1),
|
||||
?assert(is_running(NewListenerId)),
|
||||
|
||||
%% create with required options
|
||||
MinListenerId = <<"tcp:min">>,
|
||||
MinPath = emqx_mgmt_api_test_util:api_path(["listeners", MinListenerId]),
|
||||
?assertEqual({error, not_found}, is_running(MinListenerId)),
|
||||
?assertMatch({error, {"HTTP/1.1", 404, _}}, request(get, MinPath, [], [])),
|
||||
MinConf = #{
|
||||
<<"id">> => MinListenerId,
|
||||
<<"bind">> => <<"0.0.0.0:3883">>,
|
||||
<<"type">> => <<"tcp">>
|
||||
},
|
||||
MinCreate = request(post, MinPath, [], MinConf),
|
||||
?assertEqual(lists:sort(maps:keys(TcpListener)), lists:sort(maps:keys(MinCreate))),
|
||||
MinGet = request(get, MinPath, [], []),
|
||||
?assertMatch(MinCreate, MinGet),
|
||||
?assert(is_running(MinListenerId)),
|
||||
|
||||
%% bad create(same port)
|
||||
BadId = <<"tcp:bad">>,
|
||||
BadPath = emqx_mgmt_api_test_util:api_path(["listeners", BadId]),
|
||||
|
@ -79,6 +95,7 @@ t_crud_listeners_by_id(_) ->
|
|||
|
||||
%% delete
|
||||
?assertEqual([], delete(NewPath)),
|
||||
?assertEqual([], delete(MinPath)),
|
||||
?assertEqual({error, not_found}, is_running(NewListenerId)),
|
||||
?assertMatch({error, {"HTTP/1.1", 404, _}}, request(get, NewPath, [], [])),
|
||||
?assertEqual([], delete(NewPath)),
|
||||
|
|
Loading…
Reference in New Issue