mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	节点状态记录是否检查到本地防火墙
This commit is contained in:
		@@ -60,6 +60,11 @@ func (this *Firewalld) IsReady() bool {
 | 
			
		||||
	return this.isReady
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IsMock 是否为模拟
 | 
			
		||||
func (this *Firewalld) IsMock() bool {
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Firewalld) AllowPort(port int, protocol string) error {
 | 
			
		||||
	if !this.isReady {
 | 
			
		||||
		return nil
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,9 @@ type FirewallInterface interface {
 | 
			
		||||
	// IsReady 是否已准备被调用
 | 
			
		||||
	IsReady() bool
 | 
			
		||||
 | 
			
		||||
	// IsMock 是否为模拟
 | 
			
		||||
	IsMock() bool
 | 
			
		||||
 | 
			
		||||
	// AllowPort 允许端口
 | 
			
		||||
	AllowPort(port int, protocol string) error
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,11 @@ func (this *MockFirewall) IsReady() bool {
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IsMock 是否为模拟
 | 
			
		||||
func (this *MockFirewall) IsMock() bool {
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AllowPort 允许端口
 | 
			
		||||
func (this *MockFirewall) AllowPort(port int, protocol string) error {
 | 
			
		||||
	_ = port
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/caches"
 | 
			
		||||
	teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/events"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/firewalls"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/monitor"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/rpc"
 | 
			
		||||
@@ -62,7 +63,7 @@ func (this *NodeStatusExecutor) update() {
 | 
			
		||||
	var tr = trackers.Begin("UPLOAD_NODE_STATUS")
 | 
			
		||||
	defer tr.End()
 | 
			
		||||
 | 
			
		||||
	status := &nodeconfigs.NodeStatus{}
 | 
			
		||||
	var status = &nodeconfigs.NodeStatus{}
 | 
			
		||||
	status.BuildVersion = teaconst.Version
 | 
			
		||||
	status.BuildVersionCode = utils.VersionToLong(teaconst.Version)
 | 
			
		||||
	status.OS = runtime.GOOS
 | 
			
		||||
@@ -74,6 +75,8 @@ func (this *NodeStatusExecutor) update() {
 | 
			
		||||
	status.CacheTotalMemorySize = caches.SharedManager.TotalMemorySize()
 | 
			
		||||
	status.TrafficInBytes = teaconst.InTrafficBytes
 | 
			
		||||
	status.TrafficOutBytes = teaconst.OutTrafficBytes
 | 
			
		||||
	var localFirewall = firewalls.Firewall()
 | 
			
		||||
	status.HasLocalFirewall = localFirewall != nil && !localFirewall.IsMock()
 | 
			
		||||
 | 
			
		||||
	// 记录监控数据
 | 
			
		||||
	monitor.SharedValueQueue.Add(nodeconfigs.NodeValueItemConnections, maps.Map{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user