testutil

package
v0.0.0-...-d598917 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testutil provides general utilities for protocols UTs.

Package testutil provides general utilities for protocols UTs.

Index

Examples

Constants

View Source
const (
	TLSDisabled = false
	TLSEnabled  = true
)

Constants to represent whether the connection should be encrypted with TLSEnabled.

Variables

This section is empty.

Functions

func GetShortTestName

func GetShortTestName(proto, subtest string) string

GetShortTestName generates a suffix in the form "<protocol>-<subtest name>" to be passed to WithPCAP.

func WithPCAP

func WithPCAP(t *testing.T, port string, suffix string, alwaysSave bool) io.Writer

WithPCAP runs tcpdump for the duration of the test.

It returns an `io.Writer` to be used as a KeyLogWriter in tls.Config to be able, to decrypt the TLS traffic in the resulting PCAP. The resulting PCAPs and keylog files will be saved in `/tmp/test_pcaps`

Unless alwaysSave is true, WithPCAP will only save the resulting PCAP if the test fails.

Example (Plaintext)
Output:

Example (Tls)
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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