github.com/TeaOSLab/EdgeNode@v1.3.8/internal/firewalls/firewall_interface.go (about)

     1  // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
     2  
     3  package firewalls
     4  
     5  // FirewallInterface 防火墙接口
     6  type FirewallInterface interface {
     7  	// Name 名称
     8  	Name() string
     9  
    10  	// IsReady 是否已准备被调用
    11  	IsReady() bool
    12  
    13  	// IsMock 是否为模拟
    14  	IsMock() bool
    15  
    16  	// AllowPort 允许端口
    17  	AllowPort(port int, protocol string) error
    18  
    19  	// RemovePort 删除端口
    20  	RemovePort(port int, protocol string) error
    21  
    22  	// RejectSourceIP 拒绝某个源IP连接
    23  	RejectSourceIP(ip string, timeoutSeconds int) error
    24  
    25  	// DropSourceIP 丢弃某个源IP数据
    26  	// ip 要封禁的IP
    27  	// timeoutSeconds 过期时间
    28  	// async 是否异步
    29  	DropSourceIP(ip string, timeoutSeconds int, async bool) error
    30  
    31  	// RemoveSourceIP 删除某个源IP
    32  	RemoveSourceIP(ip string) error
    33  }