httpstatus

package module
v0.0.0-...-f6378c9 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2019 License: MIT Imports: 15 Imported by: 0

README

HTTP Status

Report Docs Version

HTTP Status collects timing and other statistics about an HTTP request.

This is an adaptation of davecheney/httpstat making it usable by other applications as a library.

Documentation

See the docs here.

Install

go get github.com/cbergoon/httpstatus

Example Usage

package main

import (
	"fmt"

	"github.com/cbergoon/httpstatus"
)

func main() {
	// Good Example Sites: badssl.com, neverssl.com
	t, err := httpstatus.NewHttpStatusTester("expired.badssl.com/")
	if err != nil {
		fmt.Println(err)
	}

	t.Insecure = false
	t.Run()
	fmt.Printf("%+v", t)
	for _, s := range t.Statistics {
		fmt.Printf("%+v", s)
	}
}

License

This project is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPStatistics

type HTTPStatistics struct {
	Seq int

	ConnectedTo string

	URL      *url.URL
	Location *url.URL

	Response *http.Response // TODO: HTTPX.X 200 OK TODO: Headers

	ResponseHeaders   headers
	ResponseBody      string
	ResponseBodyBytes int

	TLSHandshakeComplete bool

	DNSLookup        time.Duration
	TCPConnection    time.Duration
	TLSHandshake     time.Duration
	ServerProcessing time.Duration
	ContentTransfer  time.Duration
	NameLookup       time.Duration
	Connect          time.Duration
	PreTransfer      time.Duration
	StartTransfer    time.Duration
	Total            time.Duration

	SkippedDNS bool

	Err error
}

type HttpStatusTester

type HttpStatusTester struct {
	HTTPMethod          string
	RequestBody         string
	FollowRedirects     bool
	MaxRedirects        int
	OnlyHeader          bool
	Insecure            bool
	HTTPHeaders         headers
	ClientCertFile      string
	FourOnly            bool
	SixOnly             bool
	DiscardResponseBody bool

	Statistics []*HTTPStatistics
	// contains filtered or unexported fields
}

func NewHttpStatusTester

func NewHttpStatusTester(uri string) (*HttpStatusTester, error)

func (*HttpStatusTester) Run

func (c *HttpStatusTester) Run() error

Directories

Path Synopsis
cmd
status command

Jump to

Keyboard shortcuts

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