utils

package
v1.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigurationFilePath is the constant path to the configuration file needed to start the application
	// written from root file since the application starts from `make run`
	ConfigurationFilePath = "local-config.yml"
	// PathPing stores the defualt address of storage directory of ping data
	PathPing = "storage/ping"
	// PathJitter stores the defualt address of storage directory of jitter data
	PathJitter = "storage/jitter"
	// PathFloodPing stores the defualt address of storage directory of flood ping data
	PathFloodPing = "storage/flood-ping"
	// PathReqResDelayMonitoring stores the defualt address of storage directory of req-res and monitoring data
	PathReqResDelayMonitoring = "storage/req-res-delay-monitoring"
)
View Source
const (
	CmdPingBasedOnPacketsNumber = "ping"
	CmdAdministrator            = "sudo"
	CmdEcho                     = "echo"
)

cli command base

Variables

View Source
var (
	// PingDBNames contains the name of the database corresponding to the unique config url
	PingDBNames = make(map[string]string)
	// FloodPingDBNames contains the name of the flood ping corresponding to the unique config url
	FloodPingDBNames = make(map[string]string)
	// Pingc contains chains of all the pings operating in bench-routes which has to be globally accessed
	// This is necessary as it helps to retain the parent values which are required for concurreny
	Pingc []*tsdb.Chain

	// Jitterc is the global chain array which can be used to maintain a list of chains that represent
	// the time-series values
	Jitterc []*tsdb.Chain

	// FPingc contains chains of flood ping operations in bench-routes which has to be globally accessed
	// This is necessary as it helps to retain the parent values which are required for concurreny
	FPingc []*tsdb.Chain

	// RespMonitoringc stands for Request-Response-Delay
	RespMonitoringc []*tsdb.Chain
)

Functions

func CLIFloodPing

func CLIFloodPing(url string, packets int, password string) (*string, error)

CLIFloodPing in another subroutine, for ping operation with -f flag which sends multiple ping request at once i.e. floods the url with requests.

func CLIPing

func CLIPing(url string, packets int) (*string, error)

CLIPing works as an *independent subroutine*, for ping operations with the external networks Takes in a pointer channel in the last params inorder to implement subroutines since the ping operations might take time thereby avoiding delay in the other operations Use of pointers necessary since the data received is of large size, thereby slowing the traditional method of variables, as using variables require the time involved in loading into and out from cpu registers. Specifying addresses directly speeds the entire process manyfolds.

func Decode

func Decode(b tsdb.Block) interface{}

Decode returns the decoded persistent block after parsing from the stringified form.

func GetHash

func GetHash(s string) string

GetHash returns an unique hash code which can be used for storing values in tsdb for long urls

func SendGETRequest

func SendGETRequest(url string) *http.Response

SendGETRequest sends http GET request to the specified url(both resp_delay and monitor_response_status module use it)

func VerifyConnection

func VerifyConnection() (bool, int)

VerifyConnection verifies the connectivity of the program with the external network

Types

type FloodPing

type FloodPing struct {
	Min        float64
	Mean       float64
	Max        float64
	MDev       float64
	PacketLoss float64
}

FloodPing type for storing Ping values in TSDB

type FloodPingResp

type FloodPingResp struct {
	Min            float64 `json:"Min"`
	Mean           float64 `json:"Mean"`
	Max            float64 `json:"Max"`
	MDev           float64 `json:"MDev"`
	PacketLoss     float64 `json:"PacketLoss"`
	NormalizedTime int64   `json:"NormalizedTime"`
	Timestamp      string  `json:"Timestamp"`
	Relative       int     `json:"relative"`
}

FloodPingResp type for storing Ping values in TSDB

type JitterResp

type JitterResp struct {
	Datapoint      float64 `json:"datapoint"`
	NormalizedTime int64   `json:"NormalizedTime"`
	Timestamp      string  `json:"Timestamp"`
	Relative       int     `json:"relative"`
}

JitterResp type for storing Ping values in TSDB

type Ping

type Ping struct {
	Min  float64
	Mean float64
	Max  float64
	MDev float64
}

Ping type for storing Ping values in TSDB

type PingResp

type PingResp struct {
	Min            float64 `json:"Min"`
	Mean           float64 `json:"Mean"`
	Max            float64 `json:"Max"`
	MDev           float64 `json:"MDev"`
	NormalizedTime int64   `json:"NormalizedTime"`
	Timestamp      string  `json:"Timestamp"`
	Relative       int     `json:"relative"`
}

PingResp type for storing Ping values in TSDB

type Response

type Response struct {
	Delay         int
	ResLength     int
	ResStatusCode int
}

Response struct This is the object that we return from resp_delay module Contains delay in response and the response length

type ResponseResp

type ResponseResp struct {
	Delay          int    `json:"delay"`
	ResLength      int    `json:"resLength"`
	ResStatusCode  int    `json:"resStatusCode"`
	NormalizedTime int64  `json:"NormalizedTime"`
	Timestamp      string `json:"Timestamp"`
	Relative       int    `json:"relative"`
}

ResponseResp for responding the querier.

type TypeFloodPingScrap

type TypeFloodPingScrap struct {
	Min, Avg, Max, Mdev, PacketLoss float64
}

TypeFloodPingScrap as datatype for flood ping outputs

type TypePingScrap

type TypePingScrap struct {
	Min, Avg, Max, Mdev float64
}

TypePingScrap as datatype for ping outputs

Jump to

Keyboard shortcuts

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