mod_block

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ModBlock     = "mod_block"
	CtxBlockInfo = "mod_block.block_info"
)

Variables

View Source
var (
	ErrBlock = errors.New("BLOCK")
)

Functions

func ActionFileCheck

func ActionFileCheck(conf *ActionFile) error

func ConfModBlockCheck

func ConfModBlockCheck(cfg *ConfModBlock, confRoot string) error

func GlobalIPTableLoad

func GlobalIPTableLoad(path string) (*ipdict.IPItems, error)

GlobalIPTableLoad loads global ip table.

func ProductRuleConfLoad

func ProductRuleConfLoad(filename string) (productRuleConf, error)

ProductRuleConfLoad load block rule config from file.

Types

type Action

type Action struct {
	Cmd    string   // command of action
	Params []string // params of action
}

type ActionFile

type ActionFile struct {
	Cmd    *string  // command of action
	Params []string // params of action
}

type BlockInfo

type BlockInfo struct {
	BlockRuleName string // block rule name
}

type ConfModBlock

type ConfModBlock struct {
	Basic struct {
		ProductRulePath string // path of product block rule data
		IPBlocklistPath string // path of ip blocklist data
	}

	Log struct {
		OpenDebug bool //  whether open debug
	}
}

func ConfLoad

func ConfLoad(filePath string, confRoot string) (*ConfModBlock, error)

ConfLoad loads config from config file

func (*ConfModBlock) Check

func (cfg *ConfModBlock) Check(confRoot string) error

type ModuleBlock

type ModuleBlock struct {
	// contains filtered or unexported fields
}

func NewModuleBlock

func NewModuleBlock() *ModuleBlock

func (*ModuleBlock) Init

func (*ModuleBlock) Name

func (m *ModuleBlock) Name() string

type ModuleBlockState

type ModuleBlockState struct {
	ConnTotal    *metrics.Counter // all connnetion checked
	ConnAccept   *metrics.Counter // connection passed
	ConnRefuse   *metrics.Counter // connection refused
	ReqTotal     *metrics.Counter // all request in
	ReqAccept    *metrics.Counter // request accepted
	ReqRefuse    *metrics.Counter // request refused
	WrongCommand *metrics.Counter // request with condition satisfied, but wrong command
}

type ProductRuleTable

type ProductRuleTable struct {
	// contains filtered or unexported fields
}

func NewProductRuleTable

func NewProductRuleTable() *ProductRuleTable

func (*ProductRuleTable) Search

func (t *ProductRuleTable) Search(product string) (*blockRuleList, bool)

func (*ProductRuleTable) Update

func (t *ProductRuleTable) Update(conf productRuleConf)

type ProductRules

type ProductRules map[string]*blockRuleList

type ProductRulesFile

type ProductRulesFile map[string]*blockRuleFileList // product => list of block rules

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL