mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	初步实现HTTP3
This commit is contained in:
		@@ -12,5 +12,5 @@ dbs:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
fields:
 | 
			
		||||
  bool: [ "uamIsOn", "followPort", "requestHostExcludingPort", "autoRemoteStart", "autoInstallNftables", "enableIPLists", "detectAgents", "checkingPorts", "enableRecordHealthCheck", "offlineIsNotified" ]
 | 
			
		||||
  bool: [ "uamIsOn", "followPort", "requestHostExcludingPort", "autoRemoteStart", "autoInstallNftables", "enableIPLists", "detectAgents", "checkingPorts", "enableRecordHealthCheck", "offlineIsNotified", "http2Enabled", "http3Enabled" ]
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -996,7 +996,7 @@ func (this *NodeClusterDAO) FindClusterBasicInfo(tx *dbs.Tx, clusterId int64, ca
 | 
			
		||||
	cluster, err := this.Query(tx).
 | 
			
		||||
		Pk(clusterId).
 | 
			
		||||
		State(NodeClusterStateEnabled).
 | 
			
		||||
		Result("id", "name", "timeZone", "nodeMaxThreads", "cachePolicyId", "httpFirewallPolicyId", "autoOpenPorts", "webp", "uam", "cc", "httpPages", "isOn", "ddosProtection", "clock", "globalServerConfig", "autoInstallNftables").
 | 
			
		||||
		Result("id", "name", "timeZone", "nodeMaxThreads", "cachePolicyId", "httpFirewallPolicyId", "autoOpenPorts", "webp", "uam", "cc", "httpPages", "http3", "isOn", "ddosProtection", "clock", "globalServerConfig", "autoInstallNftables").
 | 
			
		||||
		Find()
 | 
			
		||||
	if err != nil || cluster == nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
@@ -1184,6 +1184,65 @@ func (this *NodeClusterDAO) FindClusterHTTPCCPolicy(tx *dbs.Tx, clusterId int64,
 | 
			
		||||
	return policy, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateClusterHTTP3Policy 修改HTTP3策略设置
 | 
			
		||||
func (this *NodeClusterDAO) UpdateClusterHTTP3Policy(tx *dbs.Tx, clusterId int64, http3Policy *nodeconfigs.HTTP3Policy) error {
 | 
			
		||||
	if http3Policy == nil {
 | 
			
		||||
		err := this.Query(tx).
 | 
			
		||||
			Pk(clusterId).
 | 
			
		||||
			Set("http3", dbs.SQL("null")).
 | 
			
		||||
			UpdateQuickly()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return this.NotifyHTTP3Update(tx, clusterId)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	http3PolicyJSON, err := json.Marshal(http3Policy)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	err = this.Query(tx).
 | 
			
		||||
		Pk(clusterId).
 | 
			
		||||
		Set("http3", http3PolicyJSON).
 | 
			
		||||
		UpdateQuickly()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return this.NotifyHTTP3Update(tx, clusterId)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FindClusterHTTP3Policy 查询HTTP3策略设置
 | 
			
		||||
func (this *NodeClusterDAO) FindClusterHTTP3Policy(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*nodeconfigs.HTTP3Policy, error) {
 | 
			
		||||
	var cacheKey = this.Table + ":FindClusterHTTP3Policy:" + types.String(clusterId)
 | 
			
		||||
	if cacheMap != nil {
 | 
			
		||||
		cache, ok := cacheMap.Get(cacheKey)
 | 
			
		||||
		if ok {
 | 
			
		||||
			return cache.(*nodeconfigs.HTTP3Policy), nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	http3PolicyJSON, err := this.Query(tx).
 | 
			
		||||
		Pk(clusterId).
 | 
			
		||||
		Result("http3").
 | 
			
		||||
		FindJSONCol()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if IsNull(http3PolicyJSON) {
 | 
			
		||||
		return nodeconfigs.NewHTTP3Policy(), nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var policy = nodeconfigs.NewHTTP3Policy()
 | 
			
		||||
	err = json.Unmarshal(http3PolicyJSON, policy)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return policy, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateClusterHTTPPagesPolicy 修改自定义页面设置
 | 
			
		||||
func (this *NodeClusterDAO) UpdateClusterHTTPPagesPolicy(tx *dbs.Tx, clusterId int64, httpPagesPolicy *nodeconfigs.HTTPPagesPolicy) error {
 | 
			
		||||
	if httpPagesPolicy == nil {
 | 
			
		||||
@@ -1362,6 +1421,11 @@ func (this *NodeClusterDAO) NotifyHTTPCCUpdate(tx *dbs.Tx, clusterId int64) erro
 | 
			
		||||
	return SharedNodeTaskDAO.CreateClusterTask(tx, nodeconfigs.NodeRoleNode, clusterId, 0, 0, NodeTaskTypeHTTPCCPolicyChanged)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyHTTP3Update 通知HTTP3更新
 | 
			
		||||
func (this *NodeClusterDAO) NotifyHTTP3Update(tx *dbs.Tx, clusterId int64) error {
 | 
			
		||||
	return SharedNodeTaskDAO.CreateClusterTask(tx, nodeconfigs.NodeRoleNode, clusterId, 0, 0, NodeTaskTypeHTTP3PolicyChanged)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyHTTPPagesPolicyUpdate 通知HTTP Pages更新
 | 
			
		||||
func (this *NodeClusterDAO) NotifyHTTPPagesPolicyUpdate(tx *dbs.Tx, clusterId int64) error {
 | 
			
		||||
	return SharedNodeTaskDAO.CreateClusterTask(tx, nodeconfigs.NodeRoleNode, clusterId, 0, 0, NodeTaskTypeHTTPPagesPolicyChanged)
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,7 @@ type NodeCluster struct {
 | 
			
		||||
	IsAD                 bool     `field:"isAD"`                 // 是否为高防集群
 | 
			
		||||
	HttpPages            dbs.JSON `field:"httpPages"`            // 自定义页面设置
 | 
			
		||||
	Cc                   dbs.JSON `field:"cc"`                   // CC设置
 | 
			
		||||
	Http3                dbs.JSON `field:"http3"`                // HTTP3设置
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type NodeClusterOperator struct {
 | 
			
		||||
@@ -85,6 +86,7 @@ type NodeClusterOperator struct {
 | 
			
		||||
	IsAD                 any // 是否为高防集群
 | 
			
		||||
	HttpPages            any // 自定义页面设置
 | 
			
		||||
	Cc                   any // CC设置
 | 
			
		||||
	Http3                any // HTTP3设置
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewNodeClusterOperator() *NodeClusterOperator {
 | 
			
		||||
 
 | 
			
		||||
@@ -1086,6 +1086,7 @@ func (this *NodeDAO) ComposeNodeConfig(tx *dbs.Tx, nodeId int64, dataMap *shared
 | 
			
		||||
	config.WebPImagePolicies = map[int64]*nodeconfigs.WebPImagePolicy{}
 | 
			
		||||
	config.UAMPolicies = map[int64]*nodeconfigs.UAMPolicy{}
 | 
			
		||||
	config.HTTPCCPolicies = map[int64]*nodeconfigs.HTTPCCPolicy{}
 | 
			
		||||
	config.HTTP3Policies = map[int64]*nodeconfigs.HTTP3Policy{}
 | 
			
		||||
	config.HTTPPagesPolicies = map[int64]*nodeconfigs.HTTPPagesPolicy{}
 | 
			
		||||
	var allowIPMaps = map[string]bool{}
 | 
			
		||||
	for _, clusterId := range clusterIds {
 | 
			
		||||
@@ -1198,6 +1199,16 @@ func (this *NodeDAO) ComposeNodeConfig(tx *dbs.Tx, nodeId int64, dataMap *shared
 | 
			
		||||
			config.HTTPCCPolicies[clusterId] = ccPolicy
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// HTTP3 Policy
 | 
			
		||||
		if IsNotNull(nodeCluster.Http3) {
 | 
			
		||||
			var http3Policy = nodeconfigs.NewHTTP3Policy()
 | 
			
		||||
			err = json.Unmarshal(nodeCluster.Http3, http3Policy)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
			}
 | 
			
		||||
			config.HTTP3Policies[clusterId] = http3Policy
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// HTTP Pages Policy
 | 
			
		||||
		if IsNotNull(nodeCluster.HttpPages) {
 | 
			
		||||
			var httpPagesPolicy = nodeconfigs.NewHTTPPagesPolicy()
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@ const (
 | 
			
		||||
	NodeTaskTypeUAMPolicyChanged          NodeTaskType = "uamPolicyChanged"          // UAM策略变化
 | 
			
		||||
	NodeTaskTypeHTTPPagesPolicyChanged    NodeTaskType = "httpPagesPolicyChanged"    // 自定义页面变化
 | 
			
		||||
	NodeTaskTypeHTTPCCPolicyChanged       NodeTaskType = "httpCCPolicyChanged"       // CC策略变化
 | 
			
		||||
	NodeTaskTypeHTTP3PolicyChanged        NodeTaskType = "http3PolicyChanged"        // HTTP3策略变化
 | 
			
		||||
	NodeTaskTypeUpdatingServers           NodeTaskType = "updatingServers"           // 更新一组服务
 | 
			
		||||
 | 
			
		||||
	// NS相关
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,8 @@ func (this *SSLPolicyDAO) ComposePolicyConfig(tx *dbs.Tx, policyId int64, ignore
 | 
			
		||||
	config.Id = int64(policy.Id)
 | 
			
		||||
	config.IsOn = policy.IsOn
 | 
			
		||||
	config.ClientAuthType = int(policy.ClientAuthType)
 | 
			
		||||
	config.HTTP2Enabled = policy.Http2Enabled == 1
 | 
			
		||||
	config.HTTP2Enabled = policy.Http2Enabled
 | 
			
		||||
	config.HTTP3Enabled = policy.Http3Enabled
 | 
			
		||||
	config.MinVersion = policy.MinVersion
 | 
			
		||||
 | 
			
		||||
	// certs
 | 
			
		||||
@@ -200,7 +201,7 @@ func (this *SSLPolicyDAO) FindAllEnabledPolicyIdsWithCertId(tx *dbs.Tx, certId i
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreatePolicy 创建Policy
 | 
			
		||||
func (this *SSLPolicyDAO) CreatePolicy(tx *dbs.Tx, adminId int64, userId int64, http2Enabled bool, minVersion string, certsJSON []byte, hstsJSON []byte, ocspIsOn bool, clientAuthType int32, clientCACertsJSON []byte, cipherSuitesIsOn bool, cipherSuites []string) (int64, error) {
 | 
			
		||||
func (this *SSLPolicyDAO) CreatePolicy(tx *dbs.Tx, adminId int64, userId int64, http2Enabled bool, http3Enabled bool, minVersion string, certsJSON []byte, hstsJSON []byte, ocspIsOn bool, clientAuthType int32, clientCACertsJSON []byte, cipherSuitesIsOn bool, cipherSuites []string) (int64, error) {
 | 
			
		||||
	var op = NewSSLPolicyOperator()
 | 
			
		||||
	op.State = SSLPolicyStateEnabled
 | 
			
		||||
	op.IsOn = true
 | 
			
		||||
@@ -208,6 +209,7 @@ func (this *SSLPolicyDAO) CreatePolicy(tx *dbs.Tx, adminId int64, userId int64,
 | 
			
		||||
	op.UserId = userId
 | 
			
		||||
 | 
			
		||||
	op.Http2Enabled = http2Enabled
 | 
			
		||||
	op.Http3Enabled = http3Enabled
 | 
			
		||||
	op.MinVersion = minVersion
 | 
			
		||||
 | 
			
		||||
	if len(certsJSON) > 0 {
 | 
			
		||||
@@ -240,7 +242,7 @@ func (this *SSLPolicyDAO) CreatePolicy(tx *dbs.Tx, adminId int64, userId int64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdatePolicy 修改Policy
 | 
			
		||||
func (this *SSLPolicyDAO) UpdatePolicy(tx *dbs.Tx, policyId int64, http2Enabled bool, minVersion string, certsJSON []byte, hstsJSON []byte, ocspIsOn bool, clientAuthType int32, clientCACertsJSON []byte, cipherSuitesIsOn bool, cipherSuites []string) error {
 | 
			
		||||
func (this *SSLPolicyDAO) UpdatePolicy(tx *dbs.Tx, policyId int64, http2Enabled bool, http3Enabled bool, minVersion string, certsJSON []byte, hstsJSON []byte, ocspIsOn bool, clientAuthType int32, clientCACertsJSON []byte, cipherSuitesIsOn bool, cipherSuites []string) error {
 | 
			
		||||
	if policyId <= 0 {
 | 
			
		||||
		return errors.New("invalid policyId")
 | 
			
		||||
	}
 | 
			
		||||
@@ -248,6 +250,7 @@ func (this *SSLPolicyDAO) UpdatePolicy(tx *dbs.Tx, policyId int64, http2Enabled
 | 
			
		||||
	var op = NewSSLPolicyOperator()
 | 
			
		||||
	op.Id = policyId
 | 
			
		||||
	op.Http2Enabled = http2Enabled
 | 
			
		||||
	op.Http3Enabled = http3Enabled
 | 
			
		||||
	op.MinVersion = minVersion
 | 
			
		||||
 | 
			
		||||
	if len(certsJSON) > 0 {
 | 
			
		||||
 
 | 
			
		||||
@@ -15,28 +15,30 @@ type SSLPolicy struct {
 | 
			
		||||
	CipherSuitesIsOn uint8    `field:"cipherSuitesIsOn"` // 是否自定义加密算法套件
 | 
			
		||||
	CipherSuites     dbs.JSON `field:"cipherSuites"`     // 加密算法套件
 | 
			
		||||
	Hsts             dbs.JSON `field:"hsts"`             // HSTS设置
 | 
			
		||||
	Http2Enabled     uint8    `field:"http2Enabled"`     // 是否启用HTTP/2
 | 
			
		||||
	Http2Enabled     bool     `field:"http2Enabled"`     // 是否启用HTTP/2
 | 
			
		||||
	Http3Enabled     bool     `field:"http3Enabled"`     // 是否启用HTTP/3
 | 
			
		||||
	OcspIsOn         uint8    `field:"ocspIsOn"`         // 是否启用OCSP
 | 
			
		||||
	State            uint8    `field:"state"`            // 状态
 | 
			
		||||
	CreatedAt        uint64   `field:"createdAt"`        // 创建时间
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type SSLPolicyOperator struct {
 | 
			
		||||
	Id               interface{} // ID
 | 
			
		||||
	AdminId          interface{} // 管理员ID
 | 
			
		||||
	UserId           interface{} // 用户ID
 | 
			
		||||
	IsOn             interface{} // 是否启用
 | 
			
		||||
	Certs            interface{} // 证书列表
 | 
			
		||||
	ClientCACerts    interface{} // 客户端证书
 | 
			
		||||
	ClientAuthType   interface{} // 客户端认证类型
 | 
			
		||||
	MinVersion       interface{} // 支持的SSL最小版本
 | 
			
		||||
	CipherSuitesIsOn interface{} // 是否自定义加密算法套件
 | 
			
		||||
	CipherSuites     interface{} // 加密算法套件
 | 
			
		||||
	Hsts             interface{} // HSTS设置
 | 
			
		||||
	Http2Enabled     interface{} // 是否启用HTTP/2
 | 
			
		||||
	OcspIsOn         interface{} // 是否启用OCSP
 | 
			
		||||
	State            interface{} // 状态
 | 
			
		||||
	CreatedAt        interface{} // 创建时间
 | 
			
		||||
	Id               any // ID
 | 
			
		||||
	AdminId          any // 管理员ID
 | 
			
		||||
	UserId           any // 用户ID
 | 
			
		||||
	IsOn             any // 是否启用
 | 
			
		||||
	Certs            any // 证书列表
 | 
			
		||||
	ClientCACerts    any // 客户端证书
 | 
			
		||||
	ClientAuthType   any // 客户端认证类型
 | 
			
		||||
	MinVersion       any // 支持的SSL最小版本
 | 
			
		||||
	CipherSuitesIsOn any // 是否自定义加密算法套件
 | 
			
		||||
	CipherSuites     any // 加密算法套件
 | 
			
		||||
	Hsts             any // HSTS设置
 | 
			
		||||
	Http2Enabled     any // 是否启用HTTP/2
 | 
			
		||||
	Http3Enabled     any // 是否启用HTTP/3
 | 
			
		||||
	OcspIsOn         any // 是否启用OCSP
 | 
			
		||||
	State            any // 状态
 | 
			
		||||
	CreatedAt        any // 创建时间
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewSSLPolicyOperator() *SSLPolicyOperator {
 | 
			
		||||
 
 | 
			
		||||
@@ -1180,6 +1180,16 @@ func (this *NodeClusterService) FindEnabledNodeClusterConfigInfo(ctx context.Con
 | 
			
		||||
		result.HasHTTPPagesPolicy = pagesPolicy.IsOn && len(pagesPolicy.Pages) > 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// HTTP/3
 | 
			
		||||
	if models.IsNotNull(cluster.Http3) {
 | 
			
		||||
		var http3Policy = nodeconfigs.NewHTTP3Policy()
 | 
			
		||||
		err = json.Unmarshal(cluster.Http3, http3Policy)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
		result.Http3IsOn = http3Policy.IsOn
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return result, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1301,7 +1311,6 @@ func (this *NodeClusterService) UpdateNodeClusterUAMPolicy(ctx context.Context,
 | 
			
		||||
	return this.Success()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// FindEnabledNodeClusterHTTPCCPolicy 读取集群HTTP CC策略
 | 
			
		||||
func (this *NodeClusterService) FindEnabledNodeClusterHTTPCCPolicy(ctx context.Context, req *pb.FindEnabledNodeClusterHTTPCCPolicyRequest) (*pb.FindEnabledNodeClusterHTTPCCPolicyResponse, error) {
 | 
			
		||||
	if !teaconst.IsPlus {
 | 
			
		||||
@@ -1502,3 +1511,58 @@ func (this *NodeClusterService) UpdateNodeClusterHTTPPagesPolicy(ctx context.Con
 | 
			
		||||
 | 
			
		||||
	return this.Success()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FindNodeClusterHTTP3Policy 获取集群的HTTP3设置
 | 
			
		||||
func (this *NodeClusterService) FindNodeClusterHTTP3Policy(ctx context.Context, req *pb.FindNodeClusterHTTP3PolicyRequest) (*pb.FindNodeClusterHTTP3PolicyResponse, error) {
 | 
			
		||||
	if !teaconst.IsPlus {
 | 
			
		||||
		return nil, this.NotImplementedYet()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, _, err := this.ValidateAdminAndUser(ctx, false)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var tx = this.NullTx()
 | 
			
		||||
	http3Policy, err := models.SharedNodeClusterDAO.FindClusterHTTP3Policy(tx, req.NodeClusterId, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	http3PolicyJSON, err := json.Marshal(http3Policy)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return &pb.FindNodeClusterHTTP3PolicyResponse{
 | 
			
		||||
		Http3PolicyJSON: http3PolicyJSON,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateNodeClusterHTTP3Policy 修改集群的HTTP3设置
 | 
			
		||||
func (this *NodeClusterService) UpdateNodeClusterHTTP3Policy(ctx context.Context, req *pb.UpdateNodeClusterHTTP3PolicyRequest) (*pb.RPCSuccess, error) {
 | 
			
		||||
	if !teaconst.IsPlus {
 | 
			
		||||
		return nil, this.NotImplementedYet()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, err := this.ValidateAdmin(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var http3Policy = nodeconfigs.NewHTTP3Policy()
 | 
			
		||||
	err = json.Unmarshal(req.Http3PolicyJSON, http3Policy)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = http3Policy.Init()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, errors.New("validate http3 policy failed: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var tx = this.NullTx()
 | 
			
		||||
	err = models.SharedNodeClusterDAO.UpdateClusterHTTP3Policy(tx, req.NodeClusterId, http3Policy)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return this.Success()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,10 @@ func (this *NodeService) FindNodeHTTPCCPolicies(ctx context.Context, req *pb.Fin
 | 
			
		||||
	return nil, this.NotImplementedYet()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *NodeService) FindNodeHTTP3Policies(ctx context.Context, req *pb.FindNodeHTTP3PoliciesRequest) (*pb.FindNodeHTTP3PoliciesResponse, error) {
 | 
			
		||||
	return nil, this.NotImplementedYet()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *NodeService) FindNodeHTTPPagesPolicies(ctx context.Context, req *pb.FindNodeHTTPPagesPoliciesRequest) (*pb.FindNodeHTTPPagesPoliciesResponse, error) {
 | 
			
		||||
	return nil, this.NotImplementedYet()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ func (this *SSLPolicyService) CreateSSLPolicy(ctx context.Context, req *pb.Creat
 | 
			
		||||
		// TODO
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	policyId, err := models.SharedSSLPolicyDAO.CreatePolicy(tx, adminId, userId, req.Http2Enabled, req.MinVersion, req.SslCertsJSON, req.HstsJSON, req.OcspIsOn, req.ClientAuthType, req.ClientCACertsJSON, req.CipherSuitesIsOn, req.CipherSuites)
 | 
			
		||||
	policyId, err := models.SharedSSLPolicyDAO.CreatePolicy(tx, adminId, userId, req.Http2Enabled, req.Http3Enabled, req.MinVersion, req.SslCertsJSON, req.HstsJSON, req.OcspIsOn, req.ClientAuthType, req.ClientCACertsJSON, req.CipherSuitesIsOn, req.CipherSuites)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
@@ -63,13 +63,13 @@ func (this *SSLPolicyService) UpdateSSLPolicy(ctx context.Context, req *pb.Updat
 | 
			
		||||
	var tx = this.NullTx()
 | 
			
		||||
 | 
			
		||||
	if userId > 0 {
 | 
			
		||||
		err := models.SharedSSLPolicyDAO.CheckUserPolicy(tx, userId, req.SslPolicyId)
 | 
			
		||||
		err = models.SharedSSLPolicyDAO.CheckUserPolicy(tx, userId, req.SslPolicyId)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, errors.New("check ssl policy failed: " + err.Error())
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = models.SharedSSLPolicyDAO.UpdatePolicy(tx, req.SslPolicyId, req.Http2Enabled, req.MinVersion, req.SslCertsJSON, req.HstsJSON, req.OcspIsOn, req.ClientAuthType, req.ClientCACertsJSON, req.CipherSuitesIsOn, req.CipherSuites)
 | 
			
		||||
	err = models.SharedSSLPolicyDAO.UpdatePolicy(tx, req.SslPolicyId, req.Http2Enabled, req.Http3Enabled, req.MinVersion, req.SslCertsJSON, req.HstsJSON, req.OcspIsOn, req.ClientAuthType, req.ClientCACertsJSON, req.CipherSuitesIsOn, req.CipherSuites)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -68224,7 +68224,7 @@
 | 
			
		||||
      "name": "edgeNodeClusters",
 | 
			
		||||
      "engine": "InnoDB",
 | 
			
		||||
      "charset": "utf8mb4_general_ci",
 | 
			
		||||
      "definition": "CREATE TABLE `edgeNodeClusters` (\n  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n  `adminId` int(11) unsigned DEFAULT '0' COMMENT '管理员ID',\n  `userId` int(11) unsigned DEFAULT '0' COMMENT '用户ID',\n  `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n  `name` varchar(255) DEFAULT NULL COMMENT '名称',\n  `useAllAPINodes` tinyint(1) unsigned DEFAULT '1' COMMENT '是否使用所有API节点',\n  `apiNodes` json DEFAULT NULL COMMENT '使用的API节点',\n  `installDir` varchar(512) DEFAULT NULL COMMENT '安装目录',\n  `order` int(11) unsigned DEFAULT '0' COMMENT '排序',\n  `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n  `grantId` int(11) unsigned DEFAULT '0' COMMENT '默认认证方式',\n  `sshParams` json DEFAULT NULL COMMENT 'SSH默认参数',\n  `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n  `autoRegister` tinyint(1) unsigned DEFAULT '1' COMMENT '是否开启自动注册',\n  `uniqueId` varchar(32) DEFAULT NULL COMMENT '唯一ID',\n  `secret` varchar(32) DEFAULT NULL COMMENT '密钥',\n  `healthCheck` json DEFAULT NULL COMMENT '健康检查',\n  `dnsName` varchar(255) DEFAULT NULL COMMENT 'DNS名称',\n  `dnsDomainId` int(11) unsigned DEFAULT '0' COMMENT '域名ID',\n  `dns` json DEFAULT NULL COMMENT 'DNS配置',\n  `toa` json DEFAULT NULL COMMENT 'TOA配置',\n  `cachePolicyId` int(11) unsigned DEFAULT '0' COMMENT '缓存策略ID',\n  `httpFirewallPolicyId` int(11) unsigned DEFAULT '0' COMMENT 'WAF策略ID',\n  `accessLog` json DEFAULT NULL COMMENT '访问日志设置',\n  `systemServices` json DEFAULT NULL COMMENT '系统服务设置',\n  `timeZone` varchar(64) DEFAULT NULL COMMENT '时区',\n  `nodeMaxThreads` int(11) unsigned DEFAULT '0' COMMENT '节点最大线程数',\n  `ddosProtection` json DEFAULT NULL COMMENT 'DDoS防护设置',\n  `autoOpenPorts` tinyint(1) unsigned DEFAULT '1' COMMENT '是否自动尝试开放端口',\n  `isPinned` tinyint(1) unsigned DEFAULT '0' COMMENT '是否置顶',\n  `webp` json DEFAULT NULL COMMENT 'WebP设置',\n  `uam` json DEFAULT NULL COMMENT 'UAM设置',\n  `clock` json DEFAULT NULL COMMENT '时钟配置',\n  `globalServerConfig` json DEFAULT NULL COMMENT '全局服务配置',\n  `autoRemoteStart` tinyint(1) unsigned DEFAULT '1' COMMENT '自动远程启动',\n  `autoInstallNftables` tinyint(1) unsigned DEFAULT '0' COMMENT '自动安装nftables',\n  `isAD` tinyint(1) unsigned DEFAULT '0' COMMENT '是否为高防集群',\n  `httpPages` json DEFAULT NULL COMMENT '自定义页面设置',\n  `cc` json DEFAULT NULL COMMENT 'CC设置',\n  PRIMARY KEY (`id`),\n  KEY `uniqueId` (`uniqueId`),\n  KEY `grantId` (`grantId`),\n  KEY `dnsDomainId` (`dnsDomainId`),\n  KEY `cachePolicyId` (`cachePolicyId`),\n  KEY `httpFirewallPolicyId` (`httpFirewallPolicyId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点集群'",
 | 
			
		||||
      "definition": "CREATE TABLE `edgeNodeClusters` (\n  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n  `adminId` int(11) unsigned DEFAULT '0' COMMENT '管理员ID',\n  `userId` int(11) unsigned DEFAULT '0' COMMENT '用户ID',\n  `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n  `name` varchar(255) DEFAULT NULL COMMENT '名称',\n  `useAllAPINodes` tinyint(1) unsigned DEFAULT '1' COMMENT '是否使用所有API节点',\n  `apiNodes` json DEFAULT NULL COMMENT '使用的API节点',\n  `installDir` varchar(512) DEFAULT NULL COMMENT '安装目录',\n  `order` int(11) unsigned DEFAULT '0' COMMENT '排序',\n  `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n  `grantId` int(11) unsigned DEFAULT '0' COMMENT '默认认证方式',\n  `sshParams` json DEFAULT NULL COMMENT 'SSH默认参数',\n  `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n  `autoRegister` tinyint(1) unsigned DEFAULT '1' COMMENT '是否开启自动注册',\n  `uniqueId` varchar(32) DEFAULT NULL COMMENT '唯一ID',\n  `secret` varchar(32) DEFAULT NULL COMMENT '密钥',\n  `healthCheck` json DEFAULT NULL COMMENT '健康检查',\n  `dnsName` varchar(255) DEFAULT NULL COMMENT 'DNS名称',\n  `dnsDomainId` int(11) unsigned DEFAULT '0' COMMENT '域名ID',\n  `dns` json DEFAULT NULL COMMENT 'DNS配置',\n  `toa` json DEFAULT NULL COMMENT 'TOA配置',\n  `cachePolicyId` int(11) unsigned DEFAULT '0' COMMENT '缓存策略ID',\n  `httpFirewallPolicyId` int(11) unsigned DEFAULT '0' COMMENT 'WAF策略ID',\n  `accessLog` json DEFAULT NULL COMMENT '访问日志设置',\n  `systemServices` json DEFAULT NULL COMMENT '系统服务设置',\n  `timeZone` varchar(64) DEFAULT NULL COMMENT '时区',\n  `nodeMaxThreads` int(11) unsigned DEFAULT '0' COMMENT '节点最大线程数',\n  `ddosProtection` json DEFAULT NULL COMMENT 'DDoS防护设置',\n  `autoOpenPorts` tinyint(1) unsigned DEFAULT '1' COMMENT '是否自动尝试开放端口',\n  `isPinned` tinyint(1) unsigned DEFAULT '0' COMMENT '是否置顶',\n  `webp` json DEFAULT NULL COMMENT 'WebP设置',\n  `uam` json DEFAULT NULL COMMENT 'UAM设置',\n  `clock` json DEFAULT NULL COMMENT '时钟配置',\n  `globalServerConfig` json DEFAULT NULL COMMENT '全局服务配置',\n  `autoRemoteStart` tinyint(1) unsigned DEFAULT '1' COMMENT '自动远程启动',\n  `autoInstallNftables` tinyint(1) unsigned DEFAULT '0' COMMENT '自动安装nftables',\n  `isAD` tinyint(1) unsigned DEFAULT '0' COMMENT '是否为高防集群',\n  `httpPages` json DEFAULT NULL COMMENT '自定义页面设置',\n  `cc` json DEFAULT NULL COMMENT 'CC设置',\n  `http3` json DEFAULT NULL COMMENT 'HTTP3设置',\n  PRIMARY KEY (`id`),\n  KEY `uniqueId` (`uniqueId`),\n  KEY `grantId` (`grantId`),\n  KEY `dnsDomainId` (`dnsDomainId`),\n  KEY `cachePolicyId` (`cachePolicyId`),\n  KEY `httpFirewallPolicyId` (`httpFirewallPolicyId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点集群'",
 | 
			
		||||
      "fields": [
 | 
			
		||||
        {
 | 
			
		||||
          "name": "id",
 | 
			
		||||
@@ -68381,6 +68381,10 @@
 | 
			
		||||
        {
 | 
			
		||||
          "name": "cc",
 | 
			
		||||
          "definition": "json COMMENT 'CC设置'"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "name": "http3",
 | 
			
		||||
          "definition": "json COMMENT 'HTTP3设置'"
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      "indexes": [
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user