This commit is contained in:
robin
2026-03-13 14:25:13 +08:00
parent a25a474d6a
commit afbaaa869c
95 changed files with 4591 additions and 2578 deletions

View File

@@ -11,7 +11,6 @@ import (
nodethresholds "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/settings/thresholds"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/cc"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/http3"
networksecurity "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/network-security"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/pages"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/thresholds"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/uam"
@@ -53,7 +52,6 @@ func init() {
GetPost("/thresholds", new(thresholds.IndexAction)).
//
GetPost("/network-security", new(networksecurity.IndexAction)).
// 节点设置相关
Prefix("/clusters/cluster/node/settings").

View File

@@ -1,95 +0,0 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package networksecurity
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "setting", "index")
this.SecondMenu("networkSecurity")
}
func (this *IndexAction) RunGet(params struct {
ClusterId int64
}) {
policyResp, err := this.RPC().NodeClusterRPC().FindNodeClusterNetworkSecurityPolicy(this.AdminContext(), &pb.FindNodeClusterNetworkSecurityPolicyRequest{
NodeClusterId: params.ClusterId,
})
if err != nil {
this.ErrorPage(err)
return
}
var policy = nodeconfigs.NewNetworkSecurityPolicy()
if len(policyResp.NetworkSecurityPolicyJSON) > 0 {
err = json.Unmarshal(policyResp.NetworkSecurityPolicyJSON, policy)
if err != nil {
this.ErrorPage(err)
return
}
}
this.Data["policy"] = policy
this.Show()
}
func (this *IndexAction) RunPost(params struct {
ClusterId int64
Status string
Must *actions.Must
CSRF *actionutils.CSRF
}) {
policyResp, err := this.RPC().NodeClusterRPC().FindNodeClusterNetworkSecurityPolicy(this.AdminContext(), &pb.FindNodeClusterNetworkSecurityPolicyRequest{
NodeClusterId: params.ClusterId,
})
if err != nil {
this.ErrorPage(err)
return
}
var policy = nodeconfigs.NewNetworkSecurityPolicy()
if len(policyResp.NetworkSecurityPolicyJSON) > 0 {
err = json.Unmarshal(policyResp.NetworkSecurityPolicyJSON, policy)
if err != nil {
this.ErrorPage(err)
return
}
}
policy.Status = params.Status
err = policy.Init()
if err != nil {
this.Fail("配置校验失败:" + err.Error())
return
}
policyJSON, err := json.Marshal(policy)
if err != nil {
this.ErrorPage(err)
return
}
_, err = this.RPC().NodeClusterRPC().UpdateNodeClusterNetworkSecurityPolicy(this.AdminContext(), &pb.UpdateNodeClusterNetworkSecurityPolicyRequest{
NodeClusterId: params.ClusterId,
NetworkSecurityPolicyJSON: policyJSON,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}