healthcheck

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 7 Imported by: 0

README

healthcheck

healthcheck cli for tcp, http and etc.

Install

go get github.com/bingoohuang/healthcheck/...

Usage

➜  Downloads healthcheck -h
Usage of healthcheck:
  -a string
    	address list (format ip:port ip:port)
  -f string
    	address file name(ip:port per line)
  -t string
    	connect timeout(default 3s) (default "3s")
    	
    	
➜  Downloads healthcheck -a 123.206.185.162:53306 -f ~/ip-port.txt -t 1s
Failed 2/3:
192.168.37.107:10502, error dial tcp 192.168.37.107:10502: i/o timeout
192.168.20.5:18080, error dial tcp 192.168.20.5:18080: i/o timeout

OK 1/3:
123.206.185.162:53306

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParseDuration

func MustParseDuration(s string) time.Duration

MustParseDuration 解析时长字符串,解释失败即panic

func StringSliceContains

func StringSliceContains(slice []string, item string) bool

StringSliceContains 检测字符串切片slice是否包含字符串item

Types

type Addresses

type Addresses []string

func NewAddresses

func NewAddresses() Addresses

func (Addresses) Len

func (a Addresses) Len() int

func (*Addresses) MergeAddresses

func (a *Addresses) MergeAddresses(mergedAddresses Addresses)

func (*Addresses) PrepareAddress

func (a *Addresses) PrepareAddress(addrListFileName string, directAddrString string)

type Result

type Result struct {
	TotalItems int
	OKItems    []ResultItem
	ErrorItems []ResultItem
}

func (*Result) PrintResult

func (a *Result) PrintResult()

type ResultChan

type ResultChan struct {
	OKChan    chan ResultItem
	ErrorChan chan ResultItem
}

func NewResult

func NewResult() ResultChan

func (*ResultChan) WaitResults

func (r *ResultChan) WaitResults(totalItems int) Result

type ResultItem

type ResultItem struct {
	Address string
	Error   error
}

func (*ResultItem) PrintError

func (r *ResultItem) PrintError()

func (*ResultItem) PrintOK

func (r *ResultItem) PrintOK()

type TcpChecker

type TcpChecker struct {
	Timeout time.Duration
}

func (*TcpChecker) TcpCheck

func (t *TcpChecker) TcpCheck(address string) error

func (*TcpChecker) TcpCheckSlice

func (t *TcpChecker) TcpCheckSlice(addresses []string, result ResultChan)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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