mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-11-29 18:57:41 +08:00
feat: add dgiot_mqtt bridge
This commit is contained in:
parent
d4870b0336
commit
7733f72e32
@ -71,7 +71,7 @@
|
||||
order => 3,
|
||||
type => string,
|
||||
required => true,
|
||||
default => <<"anonymous"/utf8>>,
|
||||
default => <<"dgiot"/utf8>>,
|
||||
title => #{
|
||||
zh => <<"用户名"/utf8>>
|
||||
},
|
||||
@ -83,7 +83,7 @@
|
||||
order => 4,
|
||||
type => string,
|
||||
required => true,
|
||||
default => <<"test"/utf8>>,
|
||||
default => <<"w9943535dsgfgdsgdsertet"/utf8>>,
|
||||
title => #{
|
||||
zh => <<"密码"/utf8>>
|
||||
},
|
||||
@ -91,6 +91,18 @@
|
||||
zh => <<"密码"/utf8>>
|
||||
}
|
||||
},
|
||||
<<"clientid">> => #{
|
||||
order => 4,
|
||||
type => string,
|
||||
required => true,
|
||||
default => <<"w9943535dsgfgdsgdsertet223"/utf8>>,
|
||||
title => #{
|
||||
zh => <<"ClientId"/utf8>>
|
||||
},
|
||||
description => #{
|
||||
zh => <<"ClientId"/utf8>>
|
||||
}
|
||||
},
|
||||
<<"ssl">> => #{
|
||||
order => 5,
|
||||
type => boolean,
|
||||
|
@ -28,7 +28,7 @@ childSpec(ChannelId, ChannelArgs) ->
|
||||
Options = #{
|
||||
host => binary_to_list(maps:get(<<"address">>, ChannelArgs)),
|
||||
port => maps:get(<<"port">>, ChannelArgs),
|
||||
clientid => binary_to_list(maps:get(<<"password">>, ChannelArgs)),
|
||||
clientid => binary_to_list(maps:get(<<"clientid">>, ChannelArgs)),
|
||||
ssl => maps:get(<<"ssl">>, ChannelArgs, false),
|
||||
username => binary_to_list(maps:get(<<"username">>, ChannelArgs)),
|
||||
password => binary_to_list(maps:get(<<"password">>, ChannelArgs)),
|
||||
|
@ -45,8 +45,8 @@ do_check(#{username := <<"dgiot">>, peerhost := PeerHost}, _PubSub, _Topic) when
|
||||
do_check(#{username := <<"dgiot">>, clientid := ClientId}, _PubSub, _Topic) ->
|
||||
%% io:format("~s ~p ClientId: ~p _Topic ~p ~n", [?FILE, ?LINE, ClientId, _Topic]),
|
||||
SuperPwd = dgiot_utils:to_binary(dgiot:get_env(dgiot_dlink, super_pwd, <<"">>)),
|
||||
case SuperPwd of
|
||||
ClientId ->
|
||||
case re:run(ClientId, SuperPwd, [{capture, none}]) of
|
||||
match ->
|
||||
allow;
|
||||
_ ->
|
||||
deny
|
||||
|
Loading…
Reference in New Issue
Block a user