pit

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIMEApplicationJSON = "application/json"
	MIMEApplicationForm = "application/x-www-form-urlencoded"
)
View Source
const Version = "0.4.0"

Version of current httpit

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Connections indicates how many tcp connections are used concurrently
	Connections int
	// Count is numbers of request in one benchmark round
	Count int
	// Qps specifies the highest value for a fixed benchmark, but the real qps
	// may lower than it
	Qps int
	// Duration means benchmark duration, it's ignored if Count is specified
	Duration time.Duration
	// Timeout indicates socket/request timeout
	Timeout time.Duration
	// Url is the benchmark target
	Url string
	// Method is the http method
	Method string
	// Args can set data handily for form and json request
	Args []string
	// Headers indicates http headers
	Headers []string
	// Host can override Host header in request
	Host string
	// DisableKeepAlives sets Connection header to 'close'
	DisableKeepAlives bool
	// Body is request body
	Body string
	// File indicates that read request body from a file
	File string
	// Stream indicates using stream body
	Stream bool
	// JSON indicates send a JSON request
	JSON bool
	// JSON indicates send a Form request
	Form bool
	// Insecure skips tls verification
	Insecure bool
	// Cert indicates path to the client's TLS Certificate
	Cert string
	// Cert indicates path to the client's TLS Certificate private key
	Key string
	// HttpProxy indicates an http proxy address
	HttpProxy string
	// SocksProxy indicates an socks proxy address
	SocksProxy string
	// Pipeline if true, will use fasthttp PipelineClient
	Pipeline bool
	// Follow if true, follow 30x location redirects in debug mode
	Follow bool
	// MaxRedirects indicates maximum redirect count of following 30x,
	// default is 30 (only works if Follow is true)
	MaxRedirects int
	// Debug if true, only send request once and show request and response detail
	Debug bool
	// Http2 if true, will use http2 for fasthttp
	Http2 bool
	// contains filtered or unexported fields
}

Config holds httpit settings

type Pit

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

Pit denotes httpit application

func New

func New(c Config) *Pit

New create a Pit instance with specific Config

func (Pit) Init

func (t Pit) Init() tea.Cmd

func (*Pit) Run

func (p *Pit) Run() (err error)

Run starts benchmarking

func (Pit) Update

func (t Pit) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Pit) View

func (t Pit) View() string

Jump to

Keyboard shortcuts

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