pkg

package
v0.0.0-...-c83d08b Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collects

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

Collects is a HTTP request collector

func NewCollects

func NewCollects() *Collects

NewCollects creates an instance of Collector

func (*Collects) Add

func (c *Collects) Add(req *http.Request, resp *SimpleResponse)

Add adds a HTTP request

func (*Collects) AddEvent

func (c *Collects) AddEvent(e EventHandle)

AddEvent adds new event handle

func (*Collects) Stop

func (c *Collects) Stop()

Stop stops the collector

type Controller

type Controller struct {
	WhiteList []WhiteItem `yaml:"whiteList"`
	Windows   []Window    `yaml:"windows"`
}

func ParseController

func ParseController(config string) (ctrl *Controller, err error)

func (*Controller) ConnectFilter

func (c *Controller) ConnectFilter(host string, ctx *goproxy.ProxyCtx) (*goproxy.ConnectAction, string)

type EventHandle

type EventHandle func(r *RequestAndResponse)

EventHandle is the collect event handle

type RequestAndResponse

type RequestAndResponse struct {
	Request  *http.Request
	Response *SimpleResponse
}

type SampleExporter

type SampleExporter struct {
	TestSuite testing.TestSuite
	// contains filtered or unexported fields
}

SampleExporter is a sample exporter

func NewSampleExporter

func NewSampleExporter(saveResponseBody bool) *SampleExporter

NewSampleExporter creates a new exporter

func (*SampleExporter) Add

func (e *SampleExporter) Add(reqAndResp *RequestAndResponse)

Add adds a request to the exporter

func (*SampleExporter) Export

func (e *SampleExporter) Export() (string, error)

Export exports the test suite

type SimpleResponse

type SimpleResponse struct {
	StatusCode int
	Body       string
}

type WhiteItem

type WhiteItem struct {
	Host     string        `yaml:"host"`
	Duration time.Duration `yaml:"duration"`
}

type Window

type Window struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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