mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	自动使用本地防火墙/增加edge-node [ip.drop|ip.reject|ip.remove]等命令
This commit is contained in:
		
							
								
								
									
										55
									
								
								internal/firewalls/firewall_mock.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								internal/firewalls/firewall_mock.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
 | 
			
		||||
 | 
			
		||||
package firewalls
 | 
			
		||||
 | 
			
		||||
// MockFirewall 模拟防火墙
 | 
			
		||||
type MockFirewall struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewMockFirewall() *MockFirewall {
 | 
			
		||||
	return &MockFirewall{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name 名称
 | 
			
		||||
func (this *MockFirewall) Name() string {
 | 
			
		||||
	return "mock"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IsReady 是否已准备被调用
 | 
			
		||||
func (this *MockFirewall) IsReady() bool {
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AllowPort 允许端口
 | 
			
		||||
func (this *MockFirewall) AllowPort(port int, protocol string) error {
 | 
			
		||||
	_ = port
 | 
			
		||||
	_ = protocol
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RemovePort 删除端口
 | 
			
		||||
func (this *MockFirewall) RemovePort(port int, protocol string) error {
 | 
			
		||||
	_ = port
 | 
			
		||||
	_ = protocol
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RejectSourceIP 拒绝某个源IP连接
 | 
			
		||||
func (this *MockFirewall) RejectSourceIP(ip string, timeoutSeconds int) error {
 | 
			
		||||
	_ = ip
 | 
			
		||||
	_ = timeoutSeconds
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DropSourceIP 丢弃某个源IP数据
 | 
			
		||||
func (this *MockFirewall) DropSourceIP(ip string, timeoutSeconds int) error {
 | 
			
		||||
	_ = ip
 | 
			
		||||
	_ = timeoutSeconds
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RemoveSourceIP 删除某个源IP
 | 
			
		||||
func (this *MockFirewall) RemoveSourceIP(ip string) error {
 | 
			
		||||
	_ = ip
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user