xhttp

package
v0.0.0-...-89edfd8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(url string) (string, error)

func GetCodeLongInfo

func GetCodeLongInfo(code int) string

func GetCodeShortInfo

func GetCodeShortInfo(code int) string

func GetHTTP

func GetHTTP(url string, headers []string) (string, error)

GetHTTP gets the content of a url.

func PostHTTP

func PostHTTP(url string, data string, headers []string) (*http.Response, error)

PostHTTP sends a post request

Types

type Definition

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

func GetCodeInfo

func GetCodeInfo(code int) Definition

type Hammer

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

func NewHammer

func NewHammer() *Hammer

func (*Hammer) GetDuration

func (h *Hammer) GetDuration() time.Duration

func (*Hammer) GetFailed

func (h *Hammer) GetFailed() int

func (*Hammer) GetHits

func (h *Hammer) GetHits() uint

func (*Hammer) GetQuickest

func (h *Hammer) GetQuickest() time.Duration

func (*Hammer) GetSlowest

func (h *Hammer) GetSlowest() time.Duration

func (*Hammer) GetStartTime

func (h *Hammer) GetStartTime() time.Time

func (*Hammer) Run

func (h *Hammer) Run()

main

func (*Hammer) SetDelay

func (h *Hammer) SetDelay(delay time.Duration) *Hammer

func (*Hammer) SetHitCount

func (h *Hammer) SetHitCount(number uint) *Hammer

func (*Hammer) SetSpread

func (h *Hammer) SetSpread(spread time.Duration) *Hammer

func (*Hammer) SetThreadCount

func (h *Hammer) SetThreadCount(number uint) *Hammer

func (*Hammer) SetURL

func (h *Hammer) SetURL(url string) *Hammer

type Site

type Site struct {
	Url                string
	Last_status        Status
	Last_status_string string
}

The Site struct encapsulates the details about the site being monitored.

func NewSite

func NewSite() *Site

func (*Site) LastStatus

func (s *Site) LastStatus() int

func (*Site) LastStatusString

func (s *Site) LastStatusString() string

func (*Site) SetURL

func (s *Site) SetURL(url string)

func (*Site) Status

func (s *Site) Status() (Status, error)

Site.Status makes a GET request to a given URL and checks whether or not the resulting status code is 200.

type Status

type Status int
const (
	UNCHECKED Status = iota
	DOWN
	UP
)

Jump to

Keyboard shortcuts

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