Help us shape the future of Go! Take the 2026 Go Developer Survey

tcpproxy

package
v0.106.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tcpproxy is a test TCP forwarder that a test takes down (connections refused) and brings back on the same address, to stand in for a provider outage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

type Proxy struct {
	URL string
	// contains filtered or unexported fields
}

Proxy forwards one local address to a target.

func New

func New(t testing.TB, endpoint string) *Proxy

New forwards a fresh local address to endpoint's host (any URL); it starts up. URL is endpoint's scheme with the local address.

func (*Proxy) Down

func (p *Proxy) Down()

Down closes the listener and every open connection.

func (*Proxy) Hang

func (p *Proxy) Hang(t testing.TB)

Hang accepts connections and never answers, like a black-holed endpoint. Up forwards new connections again; held ones stay hung until Down.

func (*Proxy) Up

func (p *Proxy) Up(t testing.TB)

Up listens on the same address again and forwards new connections.

Jump to

Keyboard shortcuts

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