Documentation ¶
Index ¶
- Variables
- type BaseFirewall
- type DDoSProtectionManager
- type FirewallInterface
- type Firewalld
- func (this *Firewalld) AllowPort(port int, protocol string) error
- func (this *Firewalld) AllowPortRangesPermanently(portRanges [][2]int, protocol string) error
- func (this *Firewalld) DropSourceIP(ip string, timeoutSeconds int, async bool) error
- func (this *Firewalld) IsMock() bool
- func (this *Firewalld) IsReady() bool
- func (this *Firewalld) Name() string
- func (this *Firewalld) PortRangeString(portRange [2]int, protocol string) string
- func (this *Firewalld) RejectSourceIP(ip string, timeoutSeconds int) error
- func (this *Firewalld) RemovePort(port int, protocol string) error
- func (this *Firewalld) RemovePortRangePermanently(portRange [2]int, protocol string) error
- func (this *Firewalld) RemoveSourceIP(ip string) error
- type MockFirewall
- func (this *MockFirewall) AllowPort(port int, protocol string) error
- func (this *MockFirewall) DropSourceIP(ip string, timeoutSeconds int, async bool) error
- func (this *MockFirewall) IsMock() bool
- func (this *MockFirewall) IsReady() bool
- func (this *MockFirewall) Name() string
- func (this *MockFirewall) RejectSourceIP(ip string, timeoutSeconds int) error
- func (this *MockFirewall) RemovePort(port int, protocol string) error
- func (this *MockFirewall) RemoveSourceIP(ip string) error
- type NFTablesFirewall
- func (this *NFTablesFirewall) AllowPort(port int, protocol string) error
- func (this *NFTablesFirewall) AllowSourceIP(ip string) error
- func (this *NFTablesFirewall) DropSourceIP(ip string, timeoutSeconds int, async bool) error
- func (this *NFTablesFirewall) IsMock() bool
- func (this *NFTablesFirewall) IsReady() bool
- func (this *NFTablesFirewall) Name() string
- func (this *NFTablesFirewall) RejectSourceIP(ip string, timeoutSeconds int) error
- func (this *NFTablesFirewall) RemovePort(port int, protocol string) error
- func (this *NFTablesFirewall) RemoveSourceIP(ip string) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BaseFirewall ¶ added in v0.5.2
type BaseFirewall struct {
// contains filtered or unexported fields
}
type DDoSProtectionManager ¶
type DDoSProtectionManager struct {
// contains filtered or unexported fields
}
DDoSProtectionManager DDoS防护
func NewDDoSProtectionManager ¶
func NewDDoSProtectionManager() *DDoSProtectionManager
NewDDoSProtectionManager 获取新对象
func (*DDoSProtectionManager) Apply ¶
func (this *DDoSProtectionManager) Apply(config *ddosconfigs.ProtectionConfig) error
Apply 应用配置
type FirewallInterface ¶
type FirewallInterface interface { // Name 名称 Name() string // IsReady 是否已准备被调用 IsReady() bool // IsMock 是否为模拟 IsMock() bool // AllowPort 允许端口 AllowPort(port int, protocol string) error // RemovePort 删除端口 RemovePort(port int, protocol string) error // RejectSourceIP 拒绝某个源IP连接 RejectSourceIP(ip string, timeoutSeconds int) error // DropSourceIP 丢弃某个源IP数据 // ip 要封禁的IP // timeoutSeconds 过期时间 // async 是否异步 DropSourceIP(ip string, timeoutSeconds int, async bool) error // RemoveSourceIP 删除某个源IP RemoveSourceIP(ip string) error }
FirewallInterface 防火墙接口
type Firewalld ¶
type Firewalld struct { BaseFirewall // contains filtered or unexported fields }
func NewFirewalld ¶
func NewFirewalld() *Firewalld
func (*Firewalld) AllowPortRangesPermanently ¶ added in v0.4.10
func (*Firewalld) DropSourceIP ¶
func (*Firewalld) PortRangeString ¶ added in v0.4.10
func (*Firewalld) RejectSourceIP ¶
func (*Firewalld) RemovePortRangePermanently ¶ added in v0.4.10
func (*Firewalld) RemoveSourceIP ¶
type MockFirewall ¶
type MockFirewall struct { }
MockFirewall 模拟防火墙
func NewMockFirewall ¶
func NewMockFirewall() *MockFirewall
func (*MockFirewall) AllowPort ¶
func (this *MockFirewall) AllowPort(port int, protocol string) error
AllowPort 允许端口
func (*MockFirewall) DropSourceIP ¶
func (this *MockFirewall) DropSourceIP(ip string, timeoutSeconds int, async bool) error
DropSourceIP 丢弃某个源IP数据
func (*MockFirewall) RejectSourceIP ¶
func (this *MockFirewall) RejectSourceIP(ip string, timeoutSeconds int) error
RejectSourceIP 拒绝某个源IP连接
func (*MockFirewall) RemovePort ¶
func (this *MockFirewall) RemovePort(port int, protocol string) error
RemovePort 删除端口
func (*MockFirewall) RemoveSourceIP ¶
func (this *MockFirewall) RemoveSourceIP(ip string) error
RemoveSourceIP 删除某个源IP
type NFTablesFirewall ¶
type NFTablesFirewall struct { BaseFirewall // contains filtered or unexported fields }
func NewNFTablesFirewall ¶
func NewNFTablesFirewall() (*NFTablesFirewall, error)
func (*NFTablesFirewall) AllowPort ¶
func (this *NFTablesFirewall) AllowPort(port int, protocol string) error
AllowPort 允许端口
func (*NFTablesFirewall) AllowSourceIP ¶
func (this *NFTablesFirewall) AllowSourceIP(ip string) error
AllowSourceIP Allow把IP加入白名单
func (*NFTablesFirewall) DropSourceIP ¶
func (this *NFTablesFirewall) DropSourceIP(ip string, timeoutSeconds int, async bool) error
DropSourceIP 丢弃某个源IP数据
func (*NFTablesFirewall) RejectSourceIP ¶
func (this *NFTablesFirewall) RejectSourceIP(ip string, timeoutSeconds int) error
RejectSourceIP 拒绝某个源IP连接 we did not create set for drop ip, so we reuse DropSourceIP() method here
func (*NFTablesFirewall) RemovePort ¶
func (this *NFTablesFirewall) RemovePort(port int, protocol string) error
RemovePort 删除端口
func (*NFTablesFirewall) RemoveSourceIP ¶
func (this *NFTablesFirewall) RemoveSourceIP(ip string) error
RemoveSourceIP 删除某个源IP
Source Files ¶
Click to show internal directories.
Click to hide internal directories.