tlsping

package module
v0.0.0-...-4d7a159 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 7 Imported by: 1

README

tlsping — a tool for measuring TLS handshake latency

Overview

tlsping is a command line tool to measure the time required to perform Transport Layer Security (TLS) connections with a network server.

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

How to use

Examples of usage:
  • Measure the time to establish a TCP connection to host mail.google.com port 443 and perform the TLS handshaking:

    # The hostname 'mail.google.com' resolves to an IPv4 address
    $ tlsping mail.google.com:443      
    tlsping: TLS connection to mail.google.com:443 (216.58.204.133) (10 connections)
    tlsping: min/avg/max/stddev = 95.95ms/96.31ms/96.63ms/218.19µs
    
  • Same measurement as above but connect to host www.cloudflare.com when it resolves to to IPv6 address 2606:4700::6811:d209:

    # The hostname 'www.cloudflare.com' resolves to an IPv6 address
    $ tlsping www.cloudflare.com:443 
    tlsping: TLS connection to www.cloudflare.com:443 (2606:4700::6811:d209) (10 connections)
    tlsping: min/avg/max/stddev = 85.36ms/86.63ms/88.98ms/1.14ms
    
  • Measure only the time to establish the TCP connection (i.e. do not perform TLS handshaking) to remote server at IPv6 address 2a00:1450:400a:800::2005 port 443:

    # To specify an IPv6 address and port enclose the IP address in '[' and ']'
    $ tlsping -tcponly [2a00:1450:400a:800::2005]:443
    tlsping: TCP connection to [2a00:1450:400a:800::2005]:443 (2a00:1450:400a:800::2005) (10 connections)
    tlsping: min/avg/max/stddev = 5.85ms/5.97ms/6.08ms/61.55µs
    
Synopsis
tlsping [-c count] [-tcponly] [-json] [-ca=<file>] [-insecure] <server address>
tlsping -help
tlsping -version
Getting help
tlsping -help

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/airnandez/tlsping/...

Credits

This tool was developed and is maintained by Fabio Hernandez at IN2P3 / CNRS computing center (Lyon, France).

License

Copyright 2016-2020 Fabio Hernandez

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Overview

Package tlsping measures the time needed for establishing TLS connections

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Dont perform TLS handshake. Only measure the time for
	//  estasblishing 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
}

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