feat: make tcp/ssl options more straightforward
This commit is contained in:
parent
e035ff573d
commit
dd873147b3
|
@ -1,39 +1,39 @@
|
|||
listeners.tcp.default {
|
||||
bind: "0.0.0.0:1883"
|
||||
max_connections: 1024000
|
||||
bind = "0.0.0.0:1883"
|
||||
max_connections = 1024000
|
||||
}
|
||||
|
||||
listeners.ssl.default {
|
||||
bind: "0.0.0.0:8883"
|
||||
max_connections: 512000
|
||||
ssl {
|
||||
keyfile: "{{ platform_etc_dir }}/certs/key.pem"
|
||||
certfile: "{{ platform_etc_dir }}/certs/cert.pem"
|
||||
cacertfile: "{{ platform_etc_dir }}/certs/cacert.pem"
|
||||
bind = "0.0.0.0:8883"
|
||||
max_connections = 512000
|
||||
ssl_options {
|
||||
keyfile = "{{ platform_etc_dir }}/certs/key.pem"
|
||||
certfile = "{{ platform_etc_dir }}/certs/cert.pem"
|
||||
cacertfile = "{{ platform_etc_dir }}/certs/cacert.pem"
|
||||
}
|
||||
}
|
||||
|
||||
listeners.ws.default {
|
||||
bind: "0.0.0.0:8083"
|
||||
max_connections: 1024000
|
||||
websocket.mqtt_path: "/mqtt"
|
||||
bind = "0.0.0.0:8083"
|
||||
max_connections = 1024000
|
||||
websocket.mqtt_path = "/mqtt"
|
||||
}
|
||||
|
||||
listeners.wss.default {
|
||||
bind: "0.0.0.0:8084"
|
||||
max_connections: 512000
|
||||
websocket.mqtt_path: "/mqtt"
|
||||
ssl {
|
||||
keyfile: "{{ platform_etc_dir }}/certs/key.pem"
|
||||
certfile: "{{ platform_etc_dir }}/certs/cert.pem"
|
||||
cacertfile: "{{ platform_etc_dir }}/certs/cacert.pem"
|
||||
bind = "0.0.0.0:8084"
|
||||
max_connections = 512000
|
||||
websocket.mqtt_path = "/mqtt"
|
||||
ssl_options {
|
||||
keyfile = "{{ platform_etc_dir }}/certs/key.pem"
|
||||
certfile = "{{ platform_etc_dir }}/certs/cert.pem"
|
||||
cacertfile = "{{ platform_etc_dir }}/certs/cacert.pem"
|
||||
}
|
||||
}
|
||||
|
||||
# listeners.quic.default {
|
||||
# enabled: false
|
||||
# bind: "0.0.0.0:14567"
|
||||
# max_connections: 1024000
|
||||
# keyfile: "{{ platform_etc_dir }}/certs/key.pem"
|
||||
# certfile: "{{ platform_etc_dir }}/certs/cert.pem"
|
||||
# enabled = false
|
||||
# bind = "0.0.0.0:14567"
|
||||
# max_connections = 1024000
|
||||
# keyfile = "{{ platform_etc_dir }}/certs/key.pem"
|
||||
# certfile = "{{ platform_etc_dir }}/certs/cert.pem"
|
||||
#}
|
||||
|
|
|
@ -1176,5 +1176,7 @@ get_state(Pid) ->
|
|||
)
|
||||
).
|
||||
|
||||
get_active_n(quic, _Listener) -> ?ACTIVE_N;
|
||||
get_active_n(Type, Listener) -> emqx_config:get_listener_conf(Type, Listener, [tcp, active_n]).
|
||||
get_active_n(quic, _Listener) ->
|
||||
?ACTIVE_N;
|
||||
get_active_n(Type, Listener) ->
|
||||
emqx_config:get_listener_conf(Type, Listener, [tcp_options, active_n]).
|
||||
|
|
|
@ -406,7 +406,7 @@ esockd_opts(Type, Opts0) ->
|
|||
|
||||
ws_opts(Type, ListenerName, Opts) ->
|
||||
WsPaths = [
|
||||
{maps:get(mqtt_path, Opts, "/mqtt"), emqx_ws_connection, #{
|
||||
{emqx_map_lib:deep_get([websocket, mqtt_path], Opts, "/mqtt"), emqx_ws_connection, #{
|
||||
zone => zone(Opts),
|
||||
listener => {Type, ListenerName},
|
||||
limiter => limiter(Opts)
|
||||
|
@ -497,7 +497,7 @@ limiter(Opts) ->
|
|||
ssl_opts(Opts) ->
|
||||
maps:to_list(
|
||||
emqx_tls_lib:drop_tls13_for_old_otp(
|
||||
maps:get(ssl, Opts, #{})
|
||||
maps:get(ssl_options, Opts, #{})
|
||||
)
|
||||
).
|
||||
|
||||
|
@ -505,7 +505,7 @@ tcp_opts(Opts) ->
|
|||
maps:to_list(
|
||||
maps:without(
|
||||
[active_n],
|
||||
maps:get(tcp, Opts, #{})
|
||||
maps:get(tcp_options, Opts, #{})
|
||||
)
|
||||
).
|
||||
|
||||
|
|
|
@ -787,57 +787,61 @@ fields("listeners") ->
|
|||
)}
|
||||
];
|
||||
fields("mqtt_tcp_listener") ->
|
||||
[
|
||||
{"tcp",
|
||||
sc(
|
||||
ref("tcp_opts"),
|
||||
#{}
|
||||
)}
|
||||
] ++ mqtt_listener(1883);
|
||||
mqtt_listener(1883) ++
|
||||
[
|
||||
{"tcp_options",
|
||||
sc(
|
||||
ref("tcp_opts"),
|
||||
#{}
|
||||
)}
|
||||
];
|
||||
fields("mqtt_ssl_listener") ->
|
||||
[
|
||||
{"tcp",
|
||||
sc(
|
||||
ref("tcp_opts"),
|
||||
#{}
|
||||
)},
|
||||
{"ssl",
|
||||
sc(
|
||||
ref("listener_ssl_opts"),
|
||||
#{}
|
||||
)}
|
||||
] ++ mqtt_listener(8883);
|
||||
mqtt_listener(8883) ++
|
||||
[
|
||||
{"tcp_options",
|
||||
sc(
|
||||
ref("tcp_opts"),
|
||||
#{}
|
||||
)},
|
||||
{"ssl_options",
|
||||
sc(
|
||||
ref("listener_ssl_opts"),
|
||||
#{}
|
||||
)}
|
||||
];
|
||||
fields("mqtt_ws_listener") ->
|
||||
[
|
||||
{"tcp",
|
||||
sc(
|
||||
ref("tcp_opts"),
|
||||
#{}
|
||||
)},
|
||||
{"websocket",
|
||||
sc(
|
||||
ref("ws_opts"),
|
||||
#{}
|
||||
)}
|
||||
] ++ mqtt_listener(8083);
|
||||
mqtt_listener(8083) ++
|
||||
[
|
||||
{"tcp_options",
|
||||
sc(
|
||||
ref("tcp_opts"),
|
||||
#{}
|
||||
)},
|
||||
{"websocket",
|
||||
sc(
|
||||
ref("ws_opts"),
|
||||
#{}
|
||||
)}
|
||||
];
|
||||
fields("mqtt_wss_listener") ->
|
||||
[
|
||||
{"tcp",
|
||||
sc(
|
||||
ref("tcp_opts"),
|
||||
#{}
|
||||
)},
|
||||
{"ssl",
|
||||
sc(
|
||||
ref("listener_wss_opts"),
|
||||
#{}
|
||||
)},
|
||||
{"websocket",
|
||||
sc(
|
||||
ref("ws_opts"),
|
||||
#{}
|
||||
)}
|
||||
] ++ mqtt_listener(8084);
|
||||
mqtt_listener(8084) ++
|
||||
[
|
||||
{"tcp_options",
|
||||
sc(
|
||||
ref("tcp_opts"),
|
||||
#{}
|
||||
)},
|
||||
{"ssl_options",
|
||||
sc(
|
||||
ref("listener_wss_opts"),
|
||||
#{}
|
||||
)},
|
||||
{"websocket",
|
||||
sc(
|
||||
ref("ws_opts"),
|
||||
#{}
|
||||
)}
|
||||
];
|
||||
fields("mqtt_quic_listener") ->
|
||||
[
|
||||
{"enabled",
|
||||
|
|
|
@ -1046,4 +1046,4 @@ get_ws_opts(Type, Listener, Key) ->
|
|||
emqx_config:get_listener_conf(Type, Listener, [websocket, Key]).
|
||||
|
||||
get_active_n(Type, Listener) ->
|
||||
emqx_config:get_listener_conf(Type, Listener, [tcp, active_n]).
|
||||
emqx_config:get_listener_conf(Type, Listener, [tcp_options, active_n]).
|
||||
|
|
|
@ -685,7 +685,7 @@ tcp_schema_example() ->
|
|||
proxy_protocol => false,
|
||||
proxy_protocol_timeout => <<"3s">>,
|
||||
running => true,
|
||||
tcp => #{
|
||||
tcp_options => #{
|
||||
active_n => 100,
|
||||
backlog => 1024,
|
||||
buffer => <<"4KB">>,
|
||||
|
|
Loading…
Reference in New Issue