Merge pull request #8758 from emqx/fix-listener-bind-fmt
chore: bind option support `:1883` style config
This commit is contained in:
commit
8b4d4f6a69
|
@ -13,6 +13,7 @@
|
||||||
* Updated `/nodes` API node_status from `Running/Stopped` to `running/stopped`. [#8642](https://github.com/emqx/emqx/pull/8642)
|
* Updated `/nodes` API node_status from `Running/Stopped` to `running/stopped`. [#8642](https://github.com/emqx/emqx/pull/8642)
|
||||||
* Improve handling of placeholder interpolation errors [#8635](https://github.com/emqx/emqx/pull/8635)
|
* Improve handling of placeholder interpolation errors [#8635](https://github.com/emqx/emqx/pull/8635)
|
||||||
* Better logging on unknown object IDs. [#8670](https://github.com/emqx/emqx/pull/8670)
|
* Better logging on unknown object IDs. [#8670](https://github.com/emqx/emqx/pull/8670)
|
||||||
|
* The bind option support `:1883` style. [#8758](https://github.com/emqx/emqx/pull/8758)
|
||||||
|
|
||||||
# 5.0.4
|
# 5.0.4
|
||||||
|
|
||||||
|
|
|
@ -2162,8 +2162,12 @@ to_bar_separated_list(Str) ->
|
||||||
%% - 127.0.0.1:1883
|
%% - 127.0.0.1:1883
|
||||||
%% - ::1:1883
|
%% - ::1:1883
|
||||||
%% - [::1]:1883
|
%% - [::1]:1883
|
||||||
|
%% - :1883
|
||||||
|
%% - :::1883
|
||||||
to_ip_port(Str) ->
|
to_ip_port(Str) ->
|
||||||
case split_ip_port(Str) of
|
case split_ip_port(Str) of
|
||||||
|
{"", Port} ->
|
||||||
|
{ok, {{0, 0, 0, 0}, list_to_integer(Port)}};
|
||||||
{Ip, Port} ->
|
{Ip, Port} ->
|
||||||
PortVal = list_to_integer(Port),
|
PortVal = list_to_integer(Port),
|
||||||
case inet:parse_address(Ip) of
|
case inet:parse_address(Ip) of
|
||||||
|
|
|
@ -342,11 +342,18 @@ list_listeners(get, #{query_string := Query}) ->
|
||||||
{200, listener_status_by_id(NodeL)}.
|
{200, listener_status_by_id(NodeL)}.
|
||||||
|
|
||||||
crud_listeners_by_id(get, #{bindings := #{id := Id0}}) ->
|
crud_listeners_by_id(get, #{bindings := #{id := Id0}}) ->
|
||||||
Listeners = [
|
Listeners =
|
||||||
Conf#{<<"id">> => Id, <<"type">> => Type}
|
[
|
||||||
|| {Id, Type, Conf} <- emqx_listeners:list_raw(),
|
Conf#{
|
||||||
Id =:= Id0
|
<<"id">> => Id,
|
||||||
],
|
<<"type">> => Type,
|
||||||
|
<<"bind">> := iolist_to_binary(
|
||||||
|
emqx_listeners:format_bind(maps:get(<<"bind">>, Conf))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|| {Id, Type, Conf} <- emqx_listeners:list_raw(),
|
||||||
|
Id =:= Id0
|
||||||
|
],
|
||||||
case Listeners of
|
case Listeners of
|
||||||
[] -> {404, #{code => 'BAD_LISTENER_ID', message => ?LISTENER_NOT_FOUND}};
|
[] -> {404, #{code => 'BAD_LISTENER_ID', message => ?LISTENER_NOT_FOUND}};
|
||||||
[L] -> {200, L}
|
[L] -> {200, L}
|
||||||
|
|
Loading…
Reference in New Issue