Просмотр исходного кода

Merge pull request #13086 from qzhuyan/dev/william/quic-lb

feat: quic-lb support
William Yang 1 год назад
Родитель
Сommit
bb3f858db2

+ 2 - 1
apps/emqx/rebar.config.script

@@ -24,7 +24,8 @@ IsQuicSupp = fun() ->
 end,
 
 Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}},
-Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.313"}}}.
+Quicer =
+    {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.500"}}}.
 
 Dialyzer = fun(Config) ->
     {dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),

+ 2 - 2
apps/emqx/test/emqx_quic_multistreams_SUITE.erl

@@ -841,7 +841,7 @@ t_conn_change_client_addr(Config) ->
     NewPort = select_port(),
     {ok, OldAddr} = quicer:sockname(Conn),
     ?assertEqual(
-        ok, quicer:setopt(Conn, param_conn_local_address, "127.0.0.1:" ++ integer_to_list(NewPort))
+        ok, quicer:setopt(Conn, local_address, "127.0.0.1:" ++ integer_to_list(NewPort))
     ),
     {ok, NewAddr} = quicer:sockname(Conn),
     ct:pal("NewAddr: ~p, Old Addr: ~p", [NewAddr, OldAddr]),
@@ -1681,7 +1681,7 @@ t_client_conn_bump_streams(Config) ->
     ]),
     {ok, _} = emqtt:quic_connect(C),
     {quic, Conn, _Stream} = proplists:get_value(socket, emqtt:info(C)),
-    ok = quicer:setopt(Conn, param_conn_settings, #{peer_unidi_stream_count => 20}).
+    ok = quicer:setopt(Conn, settings, #{peer_unidi_stream_count => 20}).
 
 t_olp_true(Config) ->
     meck:new(emqx_olp, [passthrough, no_history]),

+ 10 - 0
apps/emqx_conf/src/emqx_conf_schema.erl

@@ -218,6 +218,16 @@ fields("cluster") ->
                     desc => ?DESC(cluster_proto_dist)
                 }
             )},
+        {"quic_lb_mode",
+            sc(
+                integer(),
+                #{
+                    mapping => "quicer.lb_mode",
+                    default => 0,
+                    'readOnly' => true,
+                    desc => ?DESC(cluster_quic_lb_mode)
+                }
+            )},
         {"static",
             sc(
                 ?R_REF(cluster_static),

+ 3 - 1
mix.exs

@@ -815,7 +815,9 @@ defmodule EMQXUmbrella.MixProject do
   defp quicer_dep() do
     if enable_quicer?(),
       # in conflict with emqx and emqtt
-      do: [{:quicer, github: "emqx/quic", tag: "0.0.313", override: true}],
+      do: [
+        {:quicer, github: "emqx/quic", tag: "0.0.500", override: true}
+      ],
       else: []
   end
 

+ 1 - 1
rebar.config.erl

@@ -36,7 +36,7 @@ assert_otp() ->
     end.
 
 quicer() ->
-    {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.313"}}}.
+    {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.500"}}}.
 
 jq() ->
     {jq, {git, "https://github.com/emqx/jq", {tag, "v0.3.12"}}}.

+ 9 - 0
rel/i18n/emqx_conf_schema.hocon

@@ -68,6 +68,15 @@ cluster_proto_dist.desc:
 cluster_proto_dist.label:
 """Cluster Protocol Distribution"""
 
+cluster_quic_lb_mode.desc:
+"""QUIC stack LB Mode
+- 0: disabled (Default)
+- 1: server_ip
+- 2: server_id_fixed"""
+
+cluster_quic_lb_mode.label:
+""" QUIC stack LB Mode """
+
 log_burst_limit_enable.desc:
 """Enable log burst control feature."""