mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-10 04:20:27 +08:00
优化代码
This commit is contained in:
@@ -333,6 +333,21 @@ func (this *Node) loop() error {
|
|||||||
goman.New(func() {
|
goman.New(func() {
|
||||||
sharedUpgradeManager.Start()
|
sharedUpgradeManager.Start()
|
||||||
})
|
})
|
||||||
|
case "scriptsChanged":
|
||||||
|
err = this.reloadCommonScripts()
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("reload common scripts failed: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改为已同步
|
||||||
|
_, err = rpcClient.NodeTaskRPC().ReportNodeTaskDone(nodeCtx, &pb.ReportNodeTaskDoneRequest{
|
||||||
|
NodeTaskId: task.Id,
|
||||||
|
IsOk: true,
|
||||||
|
Error: "",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
internal/nodes/node_ext.go
Normal file
9
internal/nodes/node_ext.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
//go:build community
|
||||||
|
// +build community
|
||||||
|
|
||||||
|
package nodes
|
||||||
|
|
||||||
|
func (this *Node) reloadCommonScripts() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -60,7 +60,7 @@ func (this *OCSPUpdateTask) Loop() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := rpcClient.SSLCertService().ListUpdatedSSLCertOCSP(rpcClient.Context(), &pb.ListUpdatedSSLCertOCSPRequest{
|
resp, err := rpcClient.SSLCertRPC().ListUpdatedSSLCertOCSP(rpcClient.Context(), &pb.ListUpdatedSSLCertOCSPRequest{
|
||||||
Version: this.version,
|
Version: this.version,
|
||||||
Size: 100,
|
Size: 100,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -135,11 +135,11 @@ func (this *RPCClient) MetricStatRPC() pb.MetricStatServiceClient {
|
|||||||
return pb.NewMetricStatServiceClient(this.pickConn())
|
return pb.NewMetricStatServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *RPCClient) FirewallService() pb.FirewallServiceClient {
|
func (this *RPCClient) FirewallRPC() pb.FirewallServiceClient {
|
||||||
return pb.NewFirewallServiceClient(this.pickConn())
|
return pb.NewFirewallServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *RPCClient) SSLCertService() pb.SSLCertServiceClient {
|
func (this *RPCClient) SSLCertRPC() pb.SSLCertServiceClient {
|
||||||
return pb.NewSSLCertServiceClient(this.pickConn())
|
return pb.NewSSLCertServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for task := range notifyChan {
|
for task := range notifyChan {
|
||||||
_, err = rpcClient.FirewallService().NotifyHTTPFirewallEvent(rpcClient.Context(), &pb.NotifyHTTPFirewallEventRequest{
|
_, err = rpcClient.FirewallRPC().NotifyHTTPFirewallEvent(rpcClient.Context(), &pb.NotifyHTTPFirewallEventRequest{
|
||||||
ServerId: task.ServerId,
|
ServerId: task.ServerId,
|
||||||
HttpFirewallPolicyId: task.HttpFirewallPolicyId,
|
HttpFirewallPolicyId: task.HttpFirewallPolicyId,
|
||||||
HttpFirewallRuleGroupId: task.HttpFirewallRuleGroupId,
|
HttpFirewallRuleGroupId: task.HttpFirewallRuleGroupId,
|
||||||
|
|||||||
Reference in New Issue
Block a user