net

package
v0.1.0-cvefix.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputePerfStats

func ComputePerfStats(latencies, throughputs []float64) (Latency, Throughput, error)

ComputePerfStats takes arrays of Latency & Throughput to compute Statistics

func IsNetworkOrHostDown

func IsNetworkOrHostDown(err error, expectTimeouts bool) bool

IsNetworkOrHostDown - if there was a network error or if the host is down. expectTimeouts indicates that *context* timeouts are expected and does not indicate a downed host. Other timeouts still returns down.

Types

type Host

type Host struct {
	Name      string
	Port      Port
	IsPortSet bool
}

Host - holds network host IP/name and its port.

func ParseHost

func ParseHost(s string) (*Host, error)

ParseHost - parses string into Host

func (Host) Equal

func (host Host) Equal(compHost Host) bool

Equal - checks whether given host is equal or not.

func (Host) IsEmpty

func (host Host) IsEmpty() bool

IsEmpty - returns whether Host is empty or not

func (Host) MarshalJSON

func (host Host) MarshalJSON() ([]byte, error)

MarshalJSON - converts Host into JSON data

func (Host) String

func (host Host) String() string

String - returns string representation of Host.

func (*Host) UnmarshalJSON

func (host *Host) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON - parses data into Host.

type Latency

type Latency struct {
	Avg          float64 `json:"avg_secs,omitempty"`
	Percentile50 float64 `json:"percentile50_secs,omitempty"`
	Percentile90 float64 `json:"percentile90_secs,omitempty"`
	Percentile99 float64 `json:"percentile99_secs,omitempty"`
	Min          float64 `json:"min_secs,omitempty"`
	Max          float64 `json:"max_secs,omitempty"`
}

Latency holds latency information for read/write operations to the drive

type Port

type Port uint16

Port - network port

func ParsePort

func ParsePort(s string) (p Port, err error)

ParsePort - parses string into Port

func (Port) String

func (p Port) String() string

String - returns string representation of port.

type Throughput

type Throughput struct {
	Avg          float64 `json:"avg_bytes_per_sec,omitempty"`
	Percentile50 float64 `json:"percentile50_bytes_per_sec,omitempty"`
	Percentile90 float64 `json:"percentile90_bytes_per_sec,omitempty"`
	Percentile99 float64 `json:"percentile99_bytes_per_sec,omitempty"`
	Min          float64 `json:"min_bytes_per_sec,omitempty"`
	Max          float64 `json:"max_bytes_per_sec,omitempty"`
}

Throughput holds throughput information for read/write operations to the drive

type URL

type URL url.URL

URL - improved JSON friendly url.URL.

func ParseHTTPURL

func ParseHTTPURL(s string) (u *URL, err error)

ParseHTTPURL - parses a string into HTTP URL, string is expected to be of form http:// or https://

func ParseURL

func ParseURL(s string) (u *URL, err error)

ParseURL - parses string into URL.

func (URL) IsEmpty

func (u URL) IsEmpty() bool

IsEmpty - checks URL is empty or not.

func (URL) MarshalJSON

func (u URL) MarshalJSON() ([]byte, error)

MarshalJSON - converts to JSON string data.

func (URL) String

func (u URL) String() string

String - returns string representation of URL.

func (*URL) UnmarshalJSON

func (u *URL) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON - parses given data into URL.

Jump to

Keyboard shortcuts

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