core

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK          = "OK"
	StatusErr         = "Error"
	StatusErrResponse = "ErrorResponse"
)
View Source
const ITArmyConfigURL string = "https://raw.githubusercontent.com/Kashkovsky/hostmonitor/main/itarmy_targets.txt"

Variables

This section is empty.

Functions

func FanIn added in v0.2.7

func FanIn[T interface{}](cs ...<-chan T) <-chan T

func GetStringFromURL

func GetStringFromURL(url string) (string, error)

func ParceUrls added in v0.2.2

func ParceUrls(urls string) []*url.URL

Types

type Printer

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

func NewPrinter

func NewPrinter() Printer

func (*Printer) Clear

func (p *Printer) Clear()

func (*Printer) ToTable

func (p *Printer) ToTable(results *Store)

type Store added in v0.2.4

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

func NewStore added in v0.2.4

func NewStore() Store

func (*Store) AddOrUpdate added in v0.2.4

func (s *Store) AddOrUpdate(res TestResult)

func (*Store) Clear added in v0.2.4

func (s *Store) Clear()

func (*Store) ForEach added in v0.2.4

func (s *Store) ForEach(f func(TestResult) bool)

type TestResult

type TestResult struct {
	Id         string `json:"id"`
	InProgress bool   `json:"inProgress"`

	Tcp          string `json:"tcp"`
	HttpResponse string `json:"httpResponse"`
	Duration     string `json:"duration"`
	Status       string `json:"status"`
	RoundId      string
	// contains filtered or unexported fields
}

type Tester

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

func NewTester

func NewTester(config *WatchConfig, out chan TestResult) Tester

func (*Tester) Test

func (t *Tester) Test(id uuid.UUID, url *url.URL, quit <-chan bool)

type Transport

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

func NewTransport

func NewTransport(timeout time.Duration) *Transport

func (*Transport) ConnDuration

func (tr *Transport) ConnDuration() time.Duration

func (*Transport) Dial

func (tr *Transport) Dial(network, addr string) (net.Conn, error)

func (*Transport) Duration

func (tr *Transport) Duration() time.Duration

func (*Transport) ReqDuration

func (tr *Transport) ReqDuration() time.Duration

func (*Transport) RoundTrip

func (tr *Transport) RoundTrip(r *http.Request) (*http.Response, error)

type WatchConfig

type WatchConfig struct {
	ConfigUrl      string
	TestInterval   int
	RequestTimeout int
	UpdateInterval int
}

func (*WatchConfig) UpdateURLs

func (c *WatchConfig) UpdateURLs() (string, error)

type Watcher

type Watcher struct {
	Out     chan TestResult
	Updated chan bool

	RoundId *uuid.UUID
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(config *WatchConfig) Watcher

func (*Watcher) Watch

func (w *Watcher) Watch()

Jump to

Keyboard shortcuts

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