extractors

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package extractors implements extractors for http response data retrieval.

Index

Constants

This section is empty.

Variables

View Source
var ExtractorTypes = map[string]ExtractorType{
	"regex": RegexExtractor,
}

ExtractorTypes is an table for conversion of extractor type from string.

View Source
var PartTypes = map[string]Part{
	"body":   BodyPart,
	"header": HeaderPart,
	"all":    AllPart,
}

PartTypes is an table for conversion of part type from string.

Functions

This section is empty.

Types

type Extractor

type Extractor struct {
	// Type is the type of the matcher
	Type string `yaml:"type"`

	// Regex are the regex pattern required to be present in the response
	Regex []string `yaml:"regex"`

	// Part is the part of the request to match
	//
	// By default, matching is performed in request body.
	Part string `yaml:"part,omitempty"`
	// contains filtered or unexported fields
}

Extractor is used to extract part of response using a regex.

func (*Extractor) CompileExtractors

func (e *Extractor) CompileExtractors() error

CompileExtractors performs the initial setup operation on a extractor

func (*Extractor) Extract

func (e *Extractor) Extract(body, headers string) map[string]struct{}

Extract extracts response from the parts of request using a regex

func (*Extractor) ExtractDNS added in v1.1.1

func (e *Extractor) ExtractDNS(msg string) map[string]struct{}

ExtractDNS extracts response from dns message using a regex

func (*Extractor) GetPart

func (e *Extractor) GetPart() Part

GetPart returns the part of the matcher

type ExtractorType

type ExtractorType = int

ExtractorType is the type of the extractor specified

const (
	// RegexExtractor extracts responses with regexes
	RegexExtractor ExtractorType = iota + 1
)

type Part

type Part int

Part is the part of the request to match

const (
	// BodyPart matches body of the response.
	BodyPart Part = iota + 1
	// HeaderPart matches headers of the response.
	HeaderPart
	// AllPart matches both response body and headers of the response.
	AllPart
)

Jump to

Keyboard shortcuts

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