pattern

package
v0.9.3-0...-e3c37e7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TotalNumFlows keeps last flow for dropped packets
	TotalNumFlows uint = 2
	// NumFlows = 1 is enough to process packets from file
	NumFlows uint = TotalNumFlows - 1
)

Variables

This section is empty.

Functions

func SetupGoRegexps

func SetupGoRegexps(patterns []Pattern)

SetupGoRegexps compiles each regexp in pattern array and keep result in pattern.Re

Types

type HSdb

type HSdb struct {
	// Bdb is Hyperscan block database
	Bdb hyperscan.BlockDatabase
	// Scratches keep separate scratch for each handler
	Scratches [NumFlows]*hyperscan.Scratch
}

HSdb keeps Hyperscan db and scratches

func (*HSdb) CleanupHyperscan

func (hsdb *HSdb) CleanupHyperscan()

CleanupHyperscan close DB and deallocate Scratches

func (*HSdb) SetupHyperscan

func (hsdb *HSdb) SetupHyperscan(patterns []Pattern)

SetupHyperscan makes setup of Hyperscan DB and preallocates Scratches

type Pattern

type Pattern struct {
	Name   string
	Regexp string
	Re     *regexp.Regexp
	Allow  bool
}

Pattern describes one regex and action on match (allow/disallow packet)

func GetPatternsFromFile

func GetPatternsFromFile(filename string) ([]Pattern, error)

GetPatternsFromFile reads JSON file

Jump to

Keyboard shortcuts

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