app

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version of the application
	Version = "undef"

	// ProjectURL is the URL of the project
	ProjectURL = "https://github.com/fever-ch/http-ping"
)

Functions

func CheckAltSvcH3 added in v1.2.2

func CheckAltSvcH3(s string) *string

Types

type Config

type Config struct {
	IPProtocol         string
	Interval           time.Duration
	Count              int64
	Target             string
	Method             string
	UserAgent          string
	Wait               time.Duration
	DisableKeepAlive   bool
	LogLevel           int8
	ConnTarget         string
	NoCheckCertificate bool
	Cookies            []Cookie
	Headers            []Header
	Parameters         []Parameter
	IgnoreServerErrors bool
	ExtraParam         bool
	DisableCompression bool
	AudibleBell        bool
	Referrer           string
	AuthUsername       string
	AuthPassword       string
	Http1              bool
	Http2              bool
	Http3              bool
	FullDNS            bool
	DNSServer          string
	CacheDNSRequests   bool
	KeepCookies        bool
	FollowRedirects    bool
	Workers            int
	Throughput         bool
	ThroughputRefresh  time.Duration
	TestVersion        bool
}

Config defines the multiple parameters which can be passed to NewHTTPPing

type Cookie pair

Cookie is a data structure which represents the basic info about a cookie (Name and Value)

type HTTPMeasure

type HTTPMeasure struct {
	Proto string

	StatusCode   int
	Bytes        int64
	InBytes      int64
	OutBytes     int64
	SocketReused bool
	Compressed   bool
	RemoteAddr   string
	TLSEnabled   bool
	TLSVersion   string
	AltSvcH3     *string

	MeasuresCollection *stats.MeasuresCollection

	IsFailure    bool
	FailureCause string
	Headers      *http.Header
}

HTTPMeasure is the out of a measurement done as an HTTP ping

type HTTPPing

type HTTPPing interface {
	Run() error
}

HTTPPing is the main class of this app, now it contains mostly UI logic

func NewHTTPPing

func NewHTTPPing(config *Config, stdout io.Writer) (HTTPPing, error)

NewHTTPPing builds a new instance of HTTPPing or error if something goes wrong

type Header pair

Header is a data structure which represents the basic info about a HTTP header (Name and Value)

type Parameter

type Parameter pair

Parameter is a data structure which represents a request parameter (Name and Value)

type Pinger

type Pinger interface {
	Ping() <-chan *HTTPMeasure

	URL() string
}

Pinger does the calls to the actual HTTP/S component

func NewPinger

func NewPinger(config *Config, runtimeConfig *RuntimeConfig) (Pinger, error)

NewPinger builds a new pingerImpl

type RuntimeConfig

type RuntimeConfig struct {
	RedirectCallBack    func(url string)
	ResolvedConnAddress string
}

RuntimeConfig defines the parameters which can be passed to NewPinger and NewWebClientBuilder

type WebClient

type WebClient interface {
	DoMeasure(followRedirect bool) *HTTPMeasure

	GetURL() *url.URL
}

WebClient represents an HTTP/S clientBuilder designed to do performance analysis

type WebClientBuilder added in v1.2.0

type WebClientBuilder interface {
	URL() string

	SetURL(url *url.URL)

	NewInstance() WebClient
}

WebClientBuilder represents an HTTP/S clientBuilder designed to do performance analysis

func NewWebClientBuilder added in v1.2.0

func NewWebClientBuilder(config *Config, runtimeConfig *RuntimeConfig) (WebClientBuilder, error)

NewWebClientBuilder builds a new instance of webClientImpl which will provides functions for Http-Ping

Jump to

Keyboard shortcuts

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