pangpingk

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 7 Imported by: 0

README

Overview

pangpingk is stand for "Pang PING Keun" in Sundanese which mean "please to PING". This is a command line tool to measure the time required to perform TCP/TLS connections with a network server.

It concurrently establishes several network connections, performs the TCP/TLS handshake on every one of them, measures the time spent handshaking and reports a summary on the observed results.

Installation

Download a binary release for your target operating system from the releases page.

Alternatively, if you prefer to build from sources, you need the Go programming environment. Do:

go get -u github.com/matrachma/pangpingk/...

Credits

This tool was inspired by work of Fabio Hernandez's tlsping.

License

MIT License

Copyright (c) 2023 matrachma

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

Overview

Package pangpingk measures the time needed for establishing TCP/TLS connections

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Don't perform TLS handshake. Only measure the time for
	//  establishing the TCP connection
	AvoidTLSHandshake bool

	// Don't verify server certificate. Used relevant if
	// the TLS handshake is performed
	InsecureSkipVerify bool

	// Set of root certificate authorities to use to verify the server
	// certificate. This is only relevant when measuring the time spent
	// in the TLS handshake.
	// If nil, the host's set of root certificate authorities is used.
	RootCAs *x509.CertPool

	// Number of times to connect. The time spent by every connection will
	// be measured and the results will be summarized.
	Count int

	// Timeout is the maximum amount of time a dial will wait for
	// a connection to complete.
	Timeout float64
}

Config is used to configure how to time the TLS connection

type PingResult

type PingResult struct {
	// Target host name
	Host string

	// IP Address of the host used for these measurements
	IPAddr string

	// Address of the target, in the form hostname:port
	Address string

	// Number of measurements summarized in this result
	Count int

	// Minimum and maximum observed connection times, in seconds
	Min, Max float64

	// Average and standard deviation of the observed connection
	// times, in seconds
	Avg, Std float64
}

PingResult contains summary statistics of the measured connection times

func Ping

func Ping(addr string, config *Config) (PingResult, error)

Ping establishes network connections to the specified network addr and returns summary statistics of the time spent establishing those connections. The operation is governed by the provided configuration. It returns an error if at least one of the connections fails. addr is of the form 'hostname:port' The returned results do not include the time spent calling the DNS for translating the host name to IP address. This resolution is performed once and a single of retrieved IP addresses is used for all connections.

func (*PingResult) AvgStr

func (r *PingResult) AvgStr() string

func (*PingResult) MaxStr

func (r *PingResult) MaxStr() string

func (*PingResult) MinStr

func (r *PingResult) MinStr() string

func (*PingResult) StdStr

func (r *PingResult) StdStr() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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