chore(schema): don't automaticly add ipv4 address if configured as
`:1883`
This commit is contained in:
parent
03eaa07c02
commit
607f68bab1
|
@ -542,6 +542,8 @@ format_bind(Str) when is_list(Str) ->
|
||||||
case emqx_schema:to_ip_port(Str) of
|
case emqx_schema:to_ip_port(Str) of
|
||||||
{ok, {Ip, Port}} ->
|
{ok, {Ip, Port}} ->
|
||||||
format_bind({Ip, Port});
|
format_bind({Ip, Port});
|
||||||
|
{ok, Port} ->
|
||||||
|
format_bind(Port);
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
format_bind(list_to_integer(Str))
|
format_bind(list_to_integer(Str))
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
-type comma_separated_binary() :: [binary()].
|
-type comma_separated_binary() :: [binary()].
|
||||||
-type comma_separated_atoms() :: [atom()].
|
-type comma_separated_atoms() :: [atom()].
|
||||||
-type bar_separated_list() :: list().
|
-type bar_separated_list() :: list().
|
||||||
-type ip_port() :: tuple().
|
-type ip_port() :: tuple() | integer().
|
||||||
-type cipher() :: map().
|
-type cipher() :: map().
|
||||||
|
|
||||||
-typerefl_from_string({duration/0, emqx_schema, to_duration}).
|
-typerefl_from_string({duration/0, emqx_schema, to_duration}).
|
||||||
|
@ -2169,7 +2169,7 @@ to_bar_separated_list(Str) ->
|
||||||
to_ip_port(Str) ->
|
to_ip_port(Str) ->
|
||||||
case split_ip_port(Str) of
|
case split_ip_port(Str) of
|
||||||
{"", Port} ->
|
{"", Port} ->
|
||||||
{ok, {{0, 0, 0, 0}, list_to_integer(Port)}};
|
{ok, 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
|
||||||
|
|
|
@ -169,9 +169,8 @@ t_format_bind(_) ->
|
||||||
":1883",
|
":1883",
|
||||||
lists:flatten(emqx_listeners:format_bind("1883"))
|
lists:flatten(emqx_listeners:format_bind("1883"))
|
||||||
),
|
),
|
||||||
%% due to the emqx_schema:to_ip_port/1, automaticlly add the IPv4 address
|
|
||||||
?assertEqual(
|
?assertEqual(
|
||||||
"0.0.0.0:1883",
|
":1883",
|
||||||
lists:flatten(emqx_listeners:format_bind(":1883"))
|
lists:flatten(emqx_listeners:format_bind(":1883"))
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
|
@ -594,7 +594,7 @@ t_remote(_) ->
|
||||||
|
|
||||||
try
|
try
|
||||||
{ok, ClientPidLocal} = emqtt:connect(ConnPidLocal),
|
{ok, ClientPidLocal} = emqtt:connect(ConnPidLocal),
|
||||||
{ok, ClientPidRemote} = emqtt:connect(ConnPidRemote),
|
{ok, _ClientPidRemote} = emqtt:connect(ConnPidRemote),
|
||||||
|
|
||||||
emqtt:subscribe(ConnPidRemote, {<<"$share/remote_group/", Topic/binary>>, 0}),
|
emqtt:subscribe(ConnPidRemote, {<<"$share/remote_group/", Topic/binary>>, 0}),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue