Documentation ¶
Index ¶
- Constants
- Variables
- func CalcLatency(regions AWSRegions, repeats int, useHTTP bool, useHTTPS bool, service string)
- func Duration2ms(d time.Duration) float64
- type AWSHTTPRequester
- type AWSRegion
- type AWSRegions
- func (rs AWSRegions) Len() int
- func (rs AWSRegions) Less(i, j int) bool
- func (rs AWSRegions) SetCheckType(checkType CheckType)
- func (rs AWSRegions) SetDefaultTarget()
- func (rs AWSRegions) SetService(service string)
- func (rs AWSRegions) SetTarget(fn func(r *AWSRegion))
- func (rs AWSRegions) Swap(i, j int)
- type AWSRequest
- type AWSTCPRequester
- type AWSTarget
- type CheckType
- type LatencyOutput
- type RequestType
- type Requester
- type Targetter
Constants ¶
const (
// ShowOnlyRegions describes a type of output when only region's name and code printed out
ShowOnlyRegions = -1
)
Variables ¶
var (
// Version describes application version
Version = "2.0.0"
)
Functions ¶
func CalcLatency ¶
func CalcLatency(regions AWSRegions, repeats int, useHTTP bool, useHTTPS bool, service string)
CalcLatency returns list of aws regions sorted by Latency
func Duration2ms ¶
Duration2ms converts time.Duration to ms (float64)
Types ¶
type AWSHTTPRequester ¶
AWSHTTPRequester is an interface for HTTP requests
type AWSRegion ¶
type AWSRegion struct { Name string Code string Service string Latencies []time.Duration Error error CheckType CheckType Target Targetter Request Requester }
AWSRegion description of the AWS EC2 region
func (*AWSRegion) CheckLatency ¶
CheckLatency does a latency check for a region
func (*AWSRegion) GetLatency ¶
GetLatency returns Latency in ms
func (*AWSRegion) GetLatencyStr ¶
GetLatencyStr returns Latency in string
type AWSRegions ¶
type AWSRegions []AWSRegion
AWSRegions slice of the AWSRegion
func (AWSRegions) Less ¶
func (rs AWSRegions) Less(i, j int) bool
Less return a result of latency compare between two regions
func (AWSRegions) SetCheckType ¶
func (rs AWSRegions) SetCheckType(checkType CheckType)
SetCheckType sets Check Type for all regions
func (AWSRegions) SetDefaultTarget ¶
func (rs AWSRegions) SetDefaultTarget()
SetDefaultTarget sets default target instance
func (AWSRegions) SetService ¶
func (rs AWSRegions) SetService(service string)
SetService sets service for all regions
func (AWSRegions) SetTarget ¶
func (rs AWSRegions) SetTarget(fn func(r *AWSRegion))
SetTarget sets default target instance for all regions
type AWSRequest ¶
type AWSRequest struct {
// contains filtered or unexported fields
}
AWSRequest implements Requester interface
func NewAWSRequest ¶
func NewAWSRequest() *AWSRequest
NewAWSRequest creates a new instance of AWSRequest
func (*AWSRequest) Do ¶
func (r *AWSRequest) Do(ua, url string, reqType RequestType) (time.Duration, error)
Do does a request. Type of request depends on reqType
type AWSTCPRequester ¶
AWSTCPRequester is an interface for TCP requests
type AWSTarget ¶
AWSTarget implements Targetter for AWS
type LatencyOutput ¶
LatencyOutput prints data into console
func NewOutput ¶
func NewOutput(level, repeats int) *LatencyOutput
NewOutput creates a new LatencyOutput instance
type RequestType ¶
type RequestType int
RequestType describes a type for a request type
const ( // RequestTypeHTTP is HTTP type of request RequestTypeHTTP RequestType = iota // RequestTypeTCP is TCP type of request RequestTypeTCP )