diff --git a/internal/web/actions/default/servers/create.go b/internal/web/actions/default/servers/create.go index afaca5ce..19f27a0c 100644 --- a/internal/web/actions/default/servers/create.go +++ b/internal/web/actions/default/servers/create.go @@ -238,7 +238,8 @@ func (this *CreateAction) RunPost(params struct { } sslPolicyIdResp, err := this.RPC().SSLPolicyRPC().CreateSSLPolicy(this.AdminContext(), &pb.CreateSSLPolicyRequest{ - Http2Enabled: false, // 默认值 + Http2Enabled: false, // 默认值 + Http3Enabled: false, MinVersion: "TLS 1.1", // 默认值 SslCertsJSON: certRefsJSON, HstsJSON: nil, @@ -387,7 +388,7 @@ func (this *CreateAction) RunPost(params struct { AdminId: this.AdminId(), Type: params.ServerType, Name: params.Name, - ServerNamesJSON: params.ServerNames, + ServerNamesJSON: params.ServerNames, Description: params.Description, NodeClusterId: clusterId, IncludeNodesJSON: includeNodesJSON, diff --git a/internal/web/actions/default/servers/server/settings/https/index.go b/internal/web/actions/default/servers/server/settings/https/index.go index b56de9da..841c25df 100644 --- a/internal/web/actions/default/servers/server/settings/https/index.go +++ b/internal/web/actions/default/servers/server/settings/https/index.go @@ -6,6 +6,7 @@ import ( "github.com/TeaOSLab/EdgeAdmin/internal/oplogs" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils" + "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" @@ -85,11 +86,34 @@ func (this *IndexAction) RunGet(params struct { } } + // 当前集群是否支持HTTP/3 + // TODO 检查当前服务所属用户是否支持HTTP/3 + if server.NodeCluster == nil { + this.ErrorPage(errors.New("no node cluster for the server")) + return + } + http3PolicyResp, err := this.RPC().NodeClusterRPC().FindNodeClusterHTTP3Policy(this.AdminContext(), &pb.FindNodeClusterHTTP3PolicyRequest{NodeClusterId: server.NodeCluster.Id}) + if err != nil { + this.ErrorPage(err) + return + } + var supportsHTTP3 = false + if len(http3PolicyResp.Http3PolicyJSON) > 0 { + var http3Policy = nodeconfigs.NewHTTP3Policy() + err = json.Unmarshal(http3PolicyResp.Http3PolicyJSON, http3Policy) + if err != nil { + this.ErrorPage(err) + return + } + supportsHTTP3 = http3Policy.IsOn + } + this.Data["serverType"] = server.Type this.Data["httpsConfig"] = maps.Map{ - "isOn": httpsConfig.IsOn, - "addresses": httpsConfig.Listen, - "sslPolicy": sslPolicy, + "isOn": httpsConfig.IsOn, + "addresses": httpsConfig.Listen, + "sslPolicy": sslPolicy, + "supportsHTTP3": supportsHTTP3, } this.Show() @@ -175,6 +199,7 @@ func (this *IndexAction) RunPost(params struct { _, err := this.RPC().SSLPolicyRPC().UpdateSSLPolicy(this.AdminContext(), &pb.UpdateSSLPolicyRequest{ SslPolicyId: sslPolicyId, Http2Enabled: sslPolicy.HTTP2Enabled, + Http3Enabled: sslPolicy.HTTP3Enabled, MinVersion: sslPolicy.MinVersion, SslCertsJSON: certsJSON, HstsJSON: hstsJSON, @@ -191,6 +216,7 @@ func (this *IndexAction) RunPost(params struct { } else { resp, err := this.RPC().SSLPolicyRPC().CreateSSLPolicy(this.AdminContext(), &pb.CreateSSLPolicyRequest{ Http2Enabled: sslPolicy.HTTP2Enabled, + Http3Enabled: sslPolicy.HTTP3Enabled, MinVersion: sslPolicy.MinVersion, SslCertsJSON: certsJSON, HstsJSON: hstsJSON, diff --git a/internal/web/actions/default/servers/server/settings/tls/index.go b/internal/web/actions/default/servers/server/settings/tls/index.go index 70ab56c3..bbc38b06 100644 --- a/internal/web/actions/default/servers/server/settings/tls/index.go +++ b/internal/web/actions/default/servers/server/settings/tls/index.go @@ -128,6 +128,7 @@ func (this *IndexAction) RunPost(params struct { _, err := this.RPC().SSLPolicyRPC().UpdateSSLPolicy(this.AdminContext(), &pb.UpdateSSLPolicyRequest{ SslPolicyId: sslPolicyId, Http2Enabled: sslPolicy.HTTP2Enabled, + Http3Enabled: sslPolicy.HTTP3Enabled, MinVersion: sslPolicy.MinVersion, SslCertsJSON: certsJSON, HstsJSON: hstsJSON, @@ -144,6 +145,7 @@ func (this *IndexAction) RunPost(params struct { } else { resp, err := this.RPC().SSLPolicyRPC().CreateSSLPolicy(this.AdminContext(), &pb.CreateSSLPolicyRequest{ Http2Enabled: sslPolicy.HTTP2Enabled, + Http3Enabled: sslPolicy.HTTP3Enabled, MinVersion: sslPolicy.MinVersion, SslCertsJSON: certsJSON, HstsJSON: hstsJSON, diff --git a/web/public/js/components/server/ssl-config-box.js b/web/public/js/components/server/ssl-config-box.js index 45e5cccb..55ea9909 100644 --- a/web/public/js/components/server/ssl-config-box.js +++ b/web/public/js/components/server/ssl-config-box.js @@ -2,7 +2,8 @@ Vue.component("ssl-config-box", { props: [ "v-ssl-policy", "v-protocol", - "v-server-id" + "v-server-id", + "v-support-http3" ], created: function () { let that = this @@ -26,6 +27,7 @@ Vue.component("ssl-config-box", { cipherSuitesIsOn: false, cipherSuites: [], http2Enabled: true, + http3Enabled: false, ocspIsOn: false } } else { @@ -403,6 +405,15 @@ Vue.component("ssl-config-box", { +