mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	优化代码
This commit is contained in:
		@@ -6,7 +6,6 @@ import (
 | 
				
			|||||||
	"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
 | 
						"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
						"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
 | 
						"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/rpc/pb"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
 | 
				
			||||||
@@ -87,26 +86,15 @@ func (this *IndexAction) RunGet(params struct {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 当前集群是否支持HTTP/3
 | 
						// 当前集群是否支持HTTP/3
 | 
				
			||||||
	// TODO 检查当前服务所属用户是否支持HTTP/3
 | 
					 | 
				
			||||||
	if server.NodeCluster == nil {
 | 
						if server.NodeCluster == nil {
 | 
				
			||||||
		this.ErrorPage(errors.New("no node cluster for the server"))
 | 
							this.ErrorPage(errors.New("no node cluster for the server"))
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	http3PolicyResp, err := this.RPC().NodeClusterRPC().FindNodeClusterHTTP3Policy(this.AdminContext(), &pb.FindNodeClusterHTTP3PolicyRequest{NodeClusterId: server.NodeCluster.Id})
 | 
						supportsHTTP3, err := this.checkSupportsHTTP3(server.NodeCluster.Id)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.ErrorPage(err)
 | 
							this.ErrorPage(err)
 | 
				
			||||||
		return
 | 
							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["serverType"] = server.Type
 | 
				
			||||||
	this.Data["httpsConfig"] = maps.Map{
 | 
						this.Data["httpsConfig"] = maps.Map{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
				
			||||||
 | 
					//go:build !plus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package https
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (this *IndexAction) checkSupportsHTTP3(clusterId int64) (bool, error) {
 | 
				
			||||||
 | 
						return false, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user