chore: more detailed about dashboard inet6 option
This commit is contained in:
parent
b06747d961
commit
5c08c4ff4e
|
@ -74,8 +74,8 @@ Note: `sample_interval` should be a divisor of 60."""
|
|||
}
|
||||
inet6 {
|
||||
desc {
|
||||
en: "Enable IPv6 support."
|
||||
zh: "启用IPv6"
|
||||
en: "Enable IPv6 support, default is false, which means IPv4 only."
|
||||
zh: "启用IPv6, 如果机器不支持IPv6,请关闭此选项,否则会导致仪表盘无法使用。"
|
||||
}
|
||||
label {
|
||||
en: "IPv6"
|
||||
|
@ -85,7 +85,7 @@ Note: `sample_interval` should be a divisor of 60."""
|
|||
ipv6_v6only {
|
||||
desc {
|
||||
en: "Disable IPv4-to-IPv6 mapping for the listener."
|
||||
zh: "禁用IPv4-to-IPv6映射"
|
||||
zh: "当开启 inet6 功能的同时禁用 IPv4-to-IPv6 映射。该配置仅在 inet6 功能开启时有效。"
|
||||
}
|
||||
label {
|
||||
en: "IPv6 only"
|
||||
|
|
|
@ -185,8 +185,21 @@ ranch_opts(Options) ->
|
|||
socket
|
||||
],
|
||||
RanchOpts = maps:with(Keys, Options),
|
||||
SocketOpts = maps:fold(fun filter_false/3, [], maps:without([enable | Keys], Options)),
|
||||
RanchOpts#{socket_opts => SocketOpts}.
|
||||
SocketOpts = maps:fold(
|
||||
fun filter_false/3,
|
||||
[],
|
||||
maps:without([enable, inet6, ipv6_v6only | Keys], Options)
|
||||
),
|
||||
InetOpts =
|
||||
case Options of
|
||||
#{inet6 := true, ipv6_v6only := true} ->
|
||||
[inet6, {ipv6_v6only, true}];
|
||||
#{inet6 := true, ipv6_v6only := false} ->
|
||||
[inet6];
|
||||
_ ->
|
||||
[inet]
|
||||
end,
|
||||
RanchOpts#{socket_opts => InetOpts ++ SocketOpts}.
|
||||
|
||||
filter_false(_K, false, S) -> S;
|
||||
filter_false(K, V, S) -> [{K, V} | S].
|
||||
|
|
Loading…
Reference in New Issue