Add protocol in client object
This commit is contained in:
parent
ab9d7232a9
commit
18edf5cec3
|
@ -172,7 +172,7 @@ set_field(Name, Val, Channel) ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-spec(init(emqx_types:conninfo(), proplists:proplist()) -> channel()).
|
-spec(init(emqx_types:conninfo(), proplists:proplist()) -> channel()).
|
||||||
init(ConnInfo = #{peername := {PeerHost, _Port}}, Options) ->
|
init(ConnInfo = #{peername := {PeerHost, _Port}, protocol := Protocol}, Options) ->
|
||||||
Zone = proplists:get_value(zone, Options),
|
Zone = proplists:get_value(zone, Options),
|
||||||
Peercert = maps:get(peercert, ConnInfo, undefined),
|
Peercert = maps:get(peercert, ConnInfo, undefined),
|
||||||
Username = case peer_cert_as_username(Options) of
|
Username = case peer_cert_as_username(Options) of
|
||||||
|
@ -183,6 +183,7 @@ init(ConnInfo = #{peername := {PeerHost, _Port}}, Options) ->
|
||||||
end,
|
end,
|
||||||
MountPoint = emqx_zone:get_env(Zone, mountpoint),
|
MountPoint = emqx_zone:get_env(Zone, mountpoint),
|
||||||
ClientInfo = #{zone => Zone,
|
ClientInfo = #{zone => Zone,
|
||||||
|
protocol => Protocol,
|
||||||
peerhost => PeerHost,
|
peerhost => PeerHost,
|
||||||
peercert => Peercert,
|
peercert => Peercert,
|
||||||
client_id => undefined,
|
client_id => undefined,
|
||||||
|
|
|
@ -103,6 +103,7 @@
|
||||||
atom() => term()
|
atom() => term()
|
||||||
}).
|
}).
|
||||||
-type(client() :: #{zone := zone(),
|
-type(client() :: #{zone := zone(),
|
||||||
|
protocol := protocol(),
|
||||||
peerhost := peerhost(),
|
peerhost := peerhost(),
|
||||||
client_id := client_id(),
|
client_id := client_id(),
|
||||||
username := username(),
|
username := username(),
|
||||||
|
@ -121,7 +122,7 @@
|
||||||
-type(password() :: maybe(binary())).
|
-type(password() :: maybe(binary())).
|
||||||
-type(peerhost() :: inet:ip_address()).
|
-type(peerhost() :: inet:ip_address()).
|
||||||
-type(peername() :: {inet:ip_address(), inet:port_number()}).
|
-type(peername() :: {inet:ip_address(), inet:port_number()}).
|
||||||
-type(protocol() :: mqtt | 'mqtt-sn' | coap | stomp | none | atom()).
|
-type(protocol() :: mqtt | 'mqtt-sn' | coap | lwm2m | stomp | none | atom()).
|
||||||
-type(auth_result() :: success
|
-type(auth_result() :: success
|
||||||
| client_identifier_not_valid
|
| client_identifier_not_valid
|
||||||
| bad_username_or_password
|
| bad_username_or_password
|
||||||
|
|
Loading…
Reference in New Issue